# Question
Title: When are oblique triangles used in game development?
I'm working on a project that explains how trigonometry is used in video games, and I need to mention oblique triangles.

However, as far as I know, only right triangle diagrams are used in video games to perform calculations such as distance and angle.

Are right triangles always used, or are there some cases where oblique triangles are used, in which the Law of Sines and Law of Cosines are also used?

# Answer
Trigonometry is rarely applied directly in video game development. Allow me to explain what I mean by that: We will approach problems from a vector algebra standpoint first. And if you are struggling to solve something in video game development with linear algebra or trigonometry, we are going to tell you to use vectors instead.

That does not mean we never use trigonometry directly. Which would be the case of the famous `atan2` to figure out the angle of a vector in the plane. However, often, this trigonometry is hidden by libraries. We don't use it directly.

That trigonometry is in the service of vector algebra. To make rotation matrices, library will use `sin` and `cos`, similarly to convert axis-angle to a quaternion.

You will also find trigonometric functions in effects and animation. Anything cyclic or oscillating is probably using `sin`.

---

As Philipp answer mentions, there is some trigonometry in a perspective projection matrix. In particular, we use `tan` when creating a projection matrix based on camera field of view angle. See GluPerspective code.

If we also want to position a virtual camera, we will create a view matrix composing a rotation matrix (which, as mentioned above, uses `sin` and `cos`), among others.

It is possible to combine projection and view matrices before sending them to a shader. However they should not be confused. See The view matrix finally explained.

---

With that said, we do use the cosine rule. Well, we use a consequence of it: the relationship between the cosine rule and the dot product. *We would also use sine with the cross product, however that is used less often.*

Let us say we have two vectors `a` and `b`. When placed at the origin, they point to points `A` and `B` respectively. The vector that goes from `A` to `B` is `b - a`. Let us call it `c`: `c = b - a`. Thus, `a`, `b` and `c` are the vectors of the sides of the triangle `AOB` (where `O` is the origin).

Cosine law tells us that:

```
|c|^2 = |a|^2 + |b|^2 - 2|a||b|*cos(theta)

```

Where `theta` is the angle between the vectors `a` and `b`.

Now look what happens with the dot product of `c` with itself:

```
c·c = (b - a)·(b - a)

=>

c·c = a·a - a·b - b·a + b·b

=>

c·c = a·a + b·b - 2(a·b)

```

I remind you that the dot product of two vectors is the sum of the products of the components. That means that the dot product of a vector with itself is the sum of the components squared. Thus, the dot product of a vector with itself is the magnitud (length) of the vector squared (i.e. apply the Pythagoras theorem, but don't do the square root).

*This holds regardless of the number of dimensions.*

Thus, we have:

```
|c|^2 = |a|^2 + |b|^2 - 2(a·b)

```

And we can equate it to what we got from the cosine rule:

```
|a|^2 + |b|^2 - 2(a·b) = |a|^2 + |b|^2 - 2|a||b|*cos(theta)

=>

-2(a·b) = -2|a||b|*cos(theta)

=>

a·b = |a||b|*cos(theta)

=>

a·b/|a||b| = cos(theta)

=>

theta = acos(a·b/|a||b|)

```

And that way you can get the angle between two vectors *regardless of the number of dimensions*. This will work in 2D, this will work in 3D, and if you are doing a fancy 4D or whatever game, it will still work.

---

About the cross product… We all know that the result is perpendicular to the two inputs. Well, the magnitud (length) of the result is proportional to the sine of the angle:

```
|a x b| = |a||b||sin(tetha)|

```

This means that we can also get the angle between two vectors in space from the cross product. However, as you would know this approach would have to be adapted to work in 2D, since the cross product is defined in 3D but not 2D. *We can compute a wedge product in 2D whose result is the magnitud of the cross product of the inputs.*

Wedge product:

```
wedge(a,b) = a.x*b.y - a.y*b.x = |a||b|sin(tetha)

=>

tetha = asin(wedge(a,b)/|a||b|)

```

While the `atan2` gives you the angle of a vector in the plane. And the dot product can be used to get the angle between two vectors (regardless of the number of dimensions). However, note that with the wedge product is signed, and with it we get a signed angle, unlike the one we get with the dot product.

If you have a polygon as a list of points that represent a loop (so you treat the last and first as consecutive too), take consecutive triplets form it, compute the angle with the wedge product approach… If all the results you get are the same sign, your polygon is convex. If the sign changes, you have a concave polygon. *This is useful in convex hull and polygon triangulation algorithms.*

The magnitud of the cross product is also the area of the parallelogram (twice the triangle area). Thus we can use the cross product to compute the area of a polygon. *See Cross Product Parallelogram Theorem: A Direct Proof.*

For the computation of the area of the polygon, when you find a change of sign when going around the loop, it means you will be subtracting an area (remember that this happens where the shape is concave). *See Algorithm for Area of a closed polygon.*

Triangulation is useful in 3D modelling software, used to create models used in games. And also in the creation and use of navigation meshes for path-finding.
> 3 votes

# Answer
Oblique triangles appear extensively in (almost\*) every game which uses 3d rendering. Every 3d object in a game is basically a collection of oblique triangles. We usually call them "polygons" but in practice they are all triangles.

Each triangle ("polygon") is defined by its three corners ("vertices") which are in turn defined by their x, y and z coordinate in 3d space. We then use a program which runs on the GPU called a "vertex shader" to convert vertex positions in 3d space to positions on the player's 2d screen. This program usually uses a projection matrix to do so, and the creation of that matrix involves quite a lot of trigonometry.

The GPU then calculates which screen pixels are covered by that triangle on the screen and uses another program we wrote called a "pixel shader" to determine the color of each pixel of that triangle.

<sub>* 3d rendering techniques which do not use triangles are voxel rendering (which uses cubes) and raytracing (which *can* use triangles, but really shines when it can show off its ability to work directly with volumetric 3d shapes like spheres and prisms). But voxel renderers became very rare since 3d hardware acceleration became a thing and raytracing was pretty niche until very recently.</sub>
> 0 votes

---
Tags: mathematics, vector, trigonometry
---


# Question
Title: How to stop my particle systems from being frustum culled
Please could somebody advise on whether it is possible to control the culling of particle systems in Unity? I am referring to the entire system, not individual particles.

In my use-case, I am modifying the vertex transformation to get the "distant object effect".

When the camera thinks it is not viewing something it will cull it (frustum culling). For most game objects you can get around this by inflating the size of the bounds to make the camera think it is within its frustum and therefore not get culled. However, particle systems are not a single object, they are many particles and I can’t see a way of manipulating the total bounds of the system.

Any ideas?

# Answer
I found an answer in the Unity forums, which is: no it's not possible, at least not in Unity 2019.
One thing you could do is force the bounds to be larger by adding 2 particles, one in each corner at a very large value.
To do this, you can call Emit on your system to generate a particle with an infinite lifetime at an extreme position. For example, emit one at 10000, 10000, 10000 and the other at -10000, -10000, -10000.
> 1 votes

---
Tags: unity, 3d, frustum-culling
---


title: Text mesh not visible on a container

text:
# Question
Title: Text mesh not visible on a container
I have probably dumb problem with a text-mesh game object. I want to use it as a title on a top of container. I will give you all information that you need to find a problem. I'm using pixel font `Tripfive`.

1. In game result:

2. In scene result:

3D:

3. text gameObject settings:

4. all other settings that can be realted to the scene:

# Answer
> 0 votes
Okay. I've decided to change the font because it's unsupported for ui (text mesh).

---
Tags: unity, camera, text, position
---


title: How do I properly initialize UDP SDK?

text:
# Question
Title: How do I properly initialize UDP SDK?
When uploading my game to Unity Distribution Portal (UDP), I kept on receiving this message about sandbox testing:

> It seems your game was never tested in the UDP Sandbox environment, as no UDP Initialization call was found on the UDP back-end. Launch your APK in the UDP Sandbox environment to ensure it initializes properly. You must complete this step to release your game.

Now, I initially thought that Unity sandbox testing was enabled as soon as you installed the UDP plugins, but I have read that you need to make a script like this for the testing procedures to pass:

```
using UnityEngine;
using UnityEngine.UDP;

public class InitListener : IInitListener
{
     public void Initialize()
     {
          StoreService.Initialize(IInitListener listener);
     }
     public void OnInitialized(UserInfo userInfo)
     {
          Debug.Log("Initialization succeeded");
     }
     public void OnInitializeFailed(string message)
     {
          Debug.Log("Initialization failed: " + message);
     }
}

```

However, I kept on encountering a syntax error that said

> InitListener.cs(9,49): error CS1003: Syntax error, ',' expected

...Even though there's no need for a ",".

Typppi also suggested calling from another script to refer to this one, which I have made:

```
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UDP;

public Script listener;
public class Initializer : MonoBehaviour
{
    void Start()
    {
        StoreService.Initialize(IInitListener listener);
    }
}

```

Yet it still returns the same syntax error. Even then, what am I supposed to do with this initialization script? Where do I assign it?

Thank you for reading.

# Answer
The method the official unity documentation mentions is written in a confusingly non-linear way. In your initialization script, both the `initialize()` function and the `OnInitialize()` functions have to be in the same script. Thus the actual InitListener script would be:

```
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UDP;
public class InitListener : MonoBehaviour, IInitListener
{
    public IInitListener listener;
    public void Start()
    {
        StoreService.Initialize(listener);
    }

    public void OnInitialized(UserInfo userInfo)
    {
        Debug.Log("Initialization succeeded");
        // You can call the QueryInventory method here
        // to check whether there are purchases that haven’t be consumed.
    }

    public void OnInitializeFailed(string message)
    {
        Debug.Log("Initialization failed: " + message);
    }
}

```
> 0 votes

---
Tags: unity, c#, distribution
---


# Question
Title: Inserting into the first available inventory slot
Hello my inventory system picks up one item but does not pickup any more to fill the other two slots. It is saying the whole inventory is full when it should be one slot is full. Here is my code for the inventory and this is attached to the player.

```
public class MedInventory : MonoBehaviour
{
    public bool[] isFull;
    public GameObject[] MedkitSlot;
    public GameObject[] BandageSlot;
    public GameObject[] CoffeeSlot;
}

```

This next script is attached to the items you pickup.

```
    public class MedPickup : MonoBehaviour
{
    private MedInventory medInv;
    public GameObject itemButton;
    private void Start()
    {
        medInv = GameObject.FindGameObjectWithTag("Player").GetComponent<MedInventory>();
        itemButton.SetActive(false);
    }

    void OnTriggerStay2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            GameObject[] targetSlot = new GameObject[0];
            bool validItem = true;

            switch (gameObject.tag)
            {
                case "medkit": targetSlot = medInv.MedkitSlot; break;
                case "bandage": targetSlot = medInv.BandageSlot; break;
                case "coffee": targetSlot = medInv.CoffeeSlot; break;
                default: validItem = false; break;
            }

            if (validItem)
            {
                for (int i = 0; i < targetSlot.Length; ++i)
                {
                    if (!medInv.isFull[i])
                    {
                        medInv.isFull[i] = true;
                        itemButton.SetActive(true);
                        Instantiate(itemButton, targetSlot[i].transform, false);
                        Destroy(gameObject);
                        break;
                    }
                }
            }
        }
    }
}

```

# Answer
> 0 votes
First, let's simplify your pickup. We'll use an enumeration to denote our various inventory item types, so we're not constrained by the tag system and don't need to do messy string marshalling and comparisons.

```
public enum InventoryItemType : int {
    Medkit,
    Bandage,
    Coffee
}

```

Now your pickup class can be a "Plain Old Data Structure" - a coffee cup takes no actions on its own, so it needs no methods.

```
public class Pickup : MonoBehaviour {
    public InventoryItemType type;
    public RectTransform inventoryButtonPrefab;
}

```

Notice how now, we don't need every pickup in the game to hold a reference to the inventory UI - that's not the coffee cup's job!

The inventory can be managed in one place, by a script on the player character. (Or on *each* player character, allowing you to support multiplayer. Or you could allow NPCs to pick up items, etc. - much more flexibility this way)

```
public class PlayerInventory : MonoBehaviour {
    // For convenience, let's make a type that bundles together
    // the UI slot for our inventory item, and the item that's in it.
    [System.Serializable]
    public struct InventorySlot {
        public RectTransform container;
        public RectTransform contents;
    }

    public InventorySlot[] MedkitSlots;
    public InventorySlot[] BandageSlots;
    public InventorySlot[] CoffeeSlots;

    void OnTriggerEnter2D(Collider2D other) {
        // We test whether this object has the component we care about,
        // so it's free to use tags for other purposes.
        if(!other.TryGetComponent(out Pickup pickup))
            return;

        // No need to initialize this with a value we're about to overwrite anyway.
        InventorySlot[] inventory;
        switch(pickup.type) {
            case InventoryItemType.Medkit:  inventory = MedkitSlots;  break;
            case InventoryItemType.Bandage: inventory = BandageSlots; break;
            case InventoryItemType.Coffee:  inventory = CoffeeSlots;  break;
            default:
                Debug.LogErrorFormat("Unknown pickup type {0}", pickup.type);
                return;
        }

        for(int i = 0; i < inventory.Length; i++) {
            var slot = inventory[i];
            if(slot.contents != null)
                continue;

            slot.contents = Instantiate(pickup.inventoryButtonPrefab, slot.container, false);
            inventory[i] = slot; // Save our modifications to this slot.
            Destroy(other.gameObject);
            return;
        }

        Debug.LogFormat("Can't pick up {0}, inventory slots all full.", pickup.name);
    }
}

```

---
Tags: unity, c#, inventory
---


# Question
Title: How can I determine how widespread support of OpenGL ES 3 is?
I am developing new app in OpenGL which should run on iOS and Android devices. I'd like to use OpenGL ES 3. For iOS that's not a problem, since any iPhone newer than the 5 has GLES 3.

But I am not sure how wide-spread GLES 3 is in the Android world or if all new devices support it. How can I determine how much support exists for GLES 3 so I can determine if I should use it or fall back to an older version?

# Answer
The amount of how many devices support different APIs is usually easy to figure out by looking at public hardware stats of popular engines, such as unity and unreal. I recommend using multiple sources of stats to get better view of actual share of different device capabilities.
> 5 votes

# Answer
According to this wiki check...

> In June 2018, Apple deprecated OpenGL APIs on all of their platforms (iOS, macOS and tvOS), strongly encouraging developers to use their proprietary Metal API, which was introduced in 2014.
> 2 votes

---
Tags: opengl-es
---


# Question
Title: How to make goalKeeper move within post but not move towards to the player?
Hello so basically I make a 2d top-down soccer game but I have to trouble with GK AI, I want to GK is followed the ball but not move toward on it

let say (Enemy = GK)

so when the player moves to the left or right the enemy will follow to the right or left not The Yaxis but in X-axis with guarding the post or Y=0

my default enemy movement is like this :

```
if (gameObject.CompareTag("GK"))
        {

            anim.SetBool("GKRun", false);
            gkballInRange = Physics2D.OverlapCircle(transform.position, gkballRange, playerMask);
            float distancePlayer = Vector2.Distance(target.position, transform.position);

            if (gkballInRange)
            {
                if (distancePlayer <= gkballRange)
                {
                    //Animation
                    anim.SetBool("GKRun", true);
                    transform.Translate(0, -speed * Time.deltaTime, 0);
                }
            }

        }

```

in that scrip, when the ball is on the range the GK is moving to the ball just that. maybe anyone can explain to me how to do it?

# Answer
OK, this is the situation you have:

You can obtain the GK-to-Player vector by doing `target.Position - transform.Position`, and you can use that vector both to determine how the goalkeeper should move *and* to check if the player is within the goalkeeper's range. I'll refer to this vector as `relativePlayerPosition`.

Currently, though, you're just calculating the distance to the player, and loosing any information about directions:

```
float distancePlayer = Vector2.Distance(target.position, transform.position);

```

If you look at the docs for Vector2.Distance, you'll see that it's calculated as
`(target.position - transform.position).magnitude`.

So, you can do the same thing "manually", but keep the intermediate result. Calculate the relative position vector and store it into a variable, then use `magnitude` to get the distance:

```
Vector2 relativePlayerPosition = target.position - transform.position;
float distancePlayer = relativePlayerPosition.magnitude;

```

If the player is to the left of the goalie, the x component of this vector will be negative. If the player is to the right, it will be positive. You can use this fact to change the direction towards which the goalkeeper moves.

To obtain the sign of the x component, use the Mathf.Sign function (returns -1 for negative values, and 1 otherwise).

```
float xDirection = Mathf.Sign(relativePlayerPosition.x);

```

Finally, use this to modify the direction (sign) of the x parameter for the Translate method:

```
transform.Translate(xDirection * speed * Time.deltaTime, 0, 0);

```
> 0 votes

---
Tags: unity
---


# Question
Title: The player can jump forever without approaching the ground
I'm making a 2D platformer with Unity. I want to support both keyboard and gamepad, so I'm using the new Input System and Player Input component with invoke unity events behaviour. I defined two variables called **GroundedRememeber** and **JumpPressedRemember** and basically they work like timers and check if the player leaves the ground and then the player can jump when he is near the ground without need to touch it. But the problem is that these timers are not working and the player can jump forever when I press jump button rapidly.

```
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour, PlayerInputActions.IPlayerActions
 {
   private PlayerInputActions controls;
   private Rigidbody2D rb;
   private Animator anim;
   private bool facingRight = true;
   private Vector2 moveInput;
  [SerializeField] private float jumpForce;
    float JumpPressedRemember = 0;

   [SerializeField] float JumpPressedRememberTime = 0.2f;
    float GroundedRemember = 0;

   [SerializeField]  float GroundedRememberTime = 0.25f;
   [SerializeField]  float HorizontalAcceleration = 1;
   [SerializeField] [Range(0, 1)] float HorizontalDampingBasic = 0.5f;
   [SerializeField] [Range(0, 1)] float HorizontalDampingWhenStopping = 0.5f;
   [SerializeField] [Range(0, 1)] float HorizontalDampingWhenTurning = 0.5f;
   [SerializeField] [Range(0, 1)] float JumpHeight = 0.5f;

   private void Awake()
   {
      controls = new PlayerInputActions();

      controls.Player.SetCallbacks(this);
    }
     void Start()
    {
      rb = GetComponent<Rigidbody2D>();
      anim = GetComponent<Animator>();
}
   void PlayerInputActions.IPlayerActions.OnMove(InputAction.CallbackContext context)
   {
      moveInput = context.ReadValue<Vector2>();

   }

   void PlayerInputActions.IPlayerActions.OnJump(InputAction.CallbackContext context)
   {
       jumpForce = context.ReadValue<float>();
       switch (context.phase)
       {
            case InputActionPhase.Performed:
               this.Jump();
               break;
       }
   }

  void PlayerInputActions.IPlayerActions.OnShoot(InputAction.CallbackContext context)
  {

  }

   public void Jump()
   {
     rb.AddForce(Vector2.up * this.jumpForce, ForceMode2D.Force) ;

   }

  void FixedUpdate()
  {

   if(facingRight == false && moveInput.x > 0){

    Flip();

   }else if (facingRight == true && moveInput.x < 0){

    Flip();

   }
 }
    void Flip(){

    facingRight = !facingRight;
    Vector3 Scaler = transform.localScale;
    Scaler.x *= -1;
    transform.localScale = Scaler;

 }

 void OnEnable()
 {
     controls.Enable();
 }

 void OnDisable()
 {
     controls.Disable();
 }
 void Update()
  {

   Vector2 GroundedBoxCheckPosition = (Vector2)transform.position + new Vector2(0, -0.01f);
   Vector2  GroundedBoxCheckScale = (Vector2)transform.localScale + new Vector2(-0.02f, 0);
   bool Grounded = Physics2D.OverlapBox(GroundedBoxCheckPosition, transform.localScale, 0);

    GroundedRemember -= Time.deltaTime;
    if (Grounded)
    {
      GroundedRemember = GroundedRememberTime;
    }

    JumpPressedRemember -= Time.deltaTime;
   if (controls.Player.Jump.triggered)
   {
      JumpPressedRemember = JumpPressedRememberTime;
   }
     if (controls.Player.Jump.triggered)
        {
            if (rb.velocity.y > 0)
            {
                rb.velocity = new Vector2(rb.velocity.x, rb.velocity.y * JumpHeight);
            }
        }
    if ((JumpPressedRemember > 0) && (GroundedRemember > 0))
    {
       JumpPressedRemember = 0;
       GroundedRemember = 0;

      rb.velocity = new Vector2(rb.velocity.x, jumpForce);
    }
     float HorizontalVelocity = rb.velocity.x;
      HorizontalVelocity += moveInput.x;

        if (Mathf.Abs(moveInput.x) < 0.01f)
            HorizontalVelocity *= Mathf.Pow(1f - HorizontalDampingWhenStopping, Time.deltaTime * 10f);
           else if (Mathf.Sign(moveInput.x) != Mathf.Sign(HorizontalVelocity))
           HorizontalVelocity *= Mathf.Pow(1f - HorizontalDampingWhenTurning, Time.deltaTime * 10f);
        else
            HorizontalVelocity *= Mathf.Pow(1f - HorizontalDampingBasic, Time.deltaTime * 10f);

        rb.velocity = new Vector2(HorizontalVelocity, rb.velocity.y);
  }
}

```

# Answer
> 1 votes
As mentioned in the comments, it looks like this line...

```
bool Grounded = Physics2D.OverlapBox(GroundedBoxCheckPosition, transform.localScale, 0);

```

...is detecting an overlap with the player's own collider, and so it concludes that you are always "on the ground".

If you want this check to only detect "ground" objects, then you need to tell it that's what you want.

Add a new public variable to the top of your script like so:

```
[SerializeField] LayerMask groundLayers;

```

In the inspector, edit this field and check-off only those physics layers that you're using for objects the player can stand on.

Make sure the player characters themselves (and crucially, their collider(s)) are on a **different layer**.

You can add more layers if you need, and control which layers can collide with (or trigger) which other layers.

Now edit your code like so:

```
bool Grounded = Physics2D.OverlapBox(
                        GroundedBoxCheckPosition, // Center of the box to check.
                        transform.localScale,     // Size of the box to check.
                        0,                        // Rotation angle of the box.
                        groundLayers              // Which physics layers to check.
                );

```

The order is important here. `LayerMask` can convert implicitly to an `int`, and from `int` to `float`, so if you put it in the wrong argument you often won't get a compiler error, the engine will just misread your `LayerMask` as an angle or depth and carry on doing the wrong thing without warning. So be sure you've put it in the fourth slot.

---

In your latest code, you have an extra jump that's not controlled by your grounded check at all:

```
if (controls.Player.Jump.triggered) {
     if (rb.velocity.y > 0) {
        rb.velocity = new Vector2(rb.velocity.x, rb.velocity.y * JumpHeight);
     }
}

```

Anytime the player has even the slightest upward velocity, they'll be able to jump without ground nearby. Did you mean to replace this when you changed your code to use the `Remembered` variables?

---
Tags: unity, c#
---


title: Text boxes keep on moving in Unity

text:
# Question
Title: Text boxes keep on moving in Unity
I have added a few text boxes in my Unity game and they are at the bottom. When I fullscreen the game after building it, the text boxes show up in the right place but if I shrink the tab, the text boxes move and I don't want that. What can I do to fix that? I already have to move the text boxes way down to make sure they show up in fullscreen mode.

I am using Unity 2D.

In builder view:

In game view:

In full screen built view:

Steps I took to add text boxes:

I added the textboxes to the Canvas, added the scripts, and change the font color and style. I then just moved them to where I can see them but I realized that in different screen sizes, the text boxes move. I also changed the Display 1 ratio from "Free Aspect" to 16:9 but that didn't help either.

# Answer
You've configured your text boxes to position themselves relative to the center of their parent element, not relative to the bottom edge/corner:

You've also configured your canvas to position elements according to exact pixel sizes (so the size of the UI elements and their distances apart do not change with screen size):

Taken together, these two settings say:

> Position my pivot *exactly* 56 pixels left and 259 pixels below the *center* of my parent.

So if your parent element is about 600 pixels tall, that nicely positions this item close to the bottom edge. But as the parent grows, the bottom edge gets further away from the center, leaving this object behind.

The solution: if you want something to align to the bottom of the window, *you have to tell Unity that's what you want*. It's not a mind-reader.

Click the box that says "middle center" in your example to pop out the anchor presets picker, and choose one of the presets that aligns the object to the bottom of its parent:

Then adjust your positioning accordingly.

If these text elements are children of another UI element, not directly parented to the Canvas, then be sure that your parent is configured to stretch to fill the window - otherwise you could end up correctly aligning to the bottom edge of a parent, which is in turn centered on the screen, keeping your original problem at one level of remove.
> 1 votes

---
Tags: unity, text, build-process, unity-ui
---


title: Intersection of thick line with a grid

text:
# Question
Title: Intersection of thick line with a grid
There is a popular paper, and numerous examples, on how to efficiently perform collision detection for a line with a grid. However, I'm drawing up blanks on how to do the same thing but with a line that has thickness.

In my game, I'm considering adding projectiles that are not infinitly thin (for example, a giant plasma ball launcher), and I need to figure out which cells along a grid that it collides with. Initially I thought it'd be as simple as just using the Minkowski Sum method of adding the width/height of the projectile to each cell of the grid, and then treating the projectile as infinity thin line along a bloated-overlapping-grid, but that doesn't look like it's going to work with the existing algorithm.

Are there any other papers/algorithms that describe how to accomplish this? Or is there a way to modify the existing algorithm to accomplish this? Or are there any tricks to implementing this indirectly?

# Answer
If the thickness of your line / the radius of the circle following it is substantially narrower than your grid spacing, then it suffices to take the circle traversing your line and approximate it as a bounding square.

This bounding square has a leading corner (furthest ahead along its velocity vector) and a trailing corner (furthest behind).

We can use the original algorithm on these two points. Every time the leading corner enters a new cell, our bounding square has begun to overlap one or more new cells (since it spans some area, and can cross into multiple cells at once). Every time the trailing corner enters a new cell, our bounding square has exited one one or more previously-occupied cells.

Here's code that does that, in Unity-style C#:

```
public Vector2 gridSpacing = new Vector2(1, 1);

public struct CastEvent : System.IComparable<CastEvent> {
    public readonly float time;
    public readonly bool entering;
    public readonly Vector2Int cell;
    public readonly Vector2 direction;

    CastEvent(float time, bool entering, Vector2Int cell, Vector2 direction) {
        this.time = time;
        this.entering = entering;
        this.cell = cell;
        this.direction = direction;
    }

    public CastEvent Adjust(float delta, Vector2 direction) {
        return new CastEvent(time + delta, entering, cell, direction);
    }

    public static CastEvent Enter(float time, Vector2Int cell, Vector2 direction) {
        return new CastEvent(time, true, cell, direction);
    }

    public static CastEvent Exit(float time, Vector2Int cell, Vector2Int direction) {
        return new CastEvent(time, false, cell, direction);
    }

    public int CompareTo(CastEvent other) {
        return time.CompareTo(other.time);
    }
}

IEnumerator<CastEvent> CircleCastApproximate(Vector2 startPosition, Vector2 velocity, float radius, float maxTime = float.PositiveInfinity)
{
    Vector2Int direction = new Vector2Int(velocity.x >= 0f ? 1 : -1, velocity.y >= 0f ? 1 : -1);
    Vector2 leadPosition = (startPosition + radius * (Vector2)direction)/gridSpacing;
    Vector2 tailPosition = (startPosition - radius * (Vector2)direction)/gridSpacing;

    // The cells in which the top-left and bottom-right
    // corners of the circle's bounding box fall.
    Vector2Int leadCell = Vector2Int.FloorToInt(leadPosition);
    Vector2Int tailCell = Vector2Int.FloorToInt(tailPosition);

    // Cell-aligned bounding box of the circle.
    Vector2Int minCorner = Vector2Int.Min(leadCell, tailCell);
    Vector2Int maxCorner = Vector2Int.Max(leadCell, tailCell);

    // Set lead and tail positions to values in the range 0...1
    // to represent their fractional progress through their cell.
    leadPosition -= leadCell;
    tailPosition -= tailCell;

    // The time it takes to traverse one full grid cell, horizontally, and vertically.
    Vector2 timeDelta = (gridSpacing / velocity) * direction;

    // Initialize the timestamps when each point enters a new column...
    Vector2 nextEntryTime;
    Vector2 nextExitTime;
    if (velocity.x > 0f) {
        nextEntryTime.x = (1f - leadPosition.x) * timeDelta.x;
        nextExitTime.x = (1f - tailPosition.x) * timeDelta.x;
    } else if (velocity.x < 0f) {
        nextEntryTime.x = leadPosition.x * timeDelta.x;
        nextExitTime.x = tailPosition.x * timeDelta.x;
    } else {
        nextEntryTime.x = nextExitTime.x = float.PositiveInfinity;
    }

    // ...or row.
    if (velocity.y > 0f) {
        nextEntryTime.y = (1f - leadPosition.y) * timeDelta.y;
        nextExitTime.y = (1f - tailPosition.y) * timeDelta.y;
    } else if (velocity.y < 0f) {
        nextEntryTime.y = leadPosition.y * timeDelta.y;
        nextExitTime.y = tailPosition.y * timeDelta.y;
    } else {
        nextEntryTime.y = nextExitTime.y = float.PositiveInfinity;
    }

    // Log an initial collision with all of the cells we're overlapping
    // in our starting position. (Skip this to ignore initial overlaps)
    for (int x = minCorner.x; x <= maxCorner.x; x++) {
        for (int y = minCorner.y; y <= maxCorner.y; y++) {
            yield return CastEvent.Enter(0f, new Vector2Int(x, y), Vector2Int.zero);
        }
    }

    float accumulatedTime = 0f;
    while(true) {
        float nextEventTime = Mathf.Min(nextEntryTime.x, nextEntryTime.y, nextExitTime.x, nextExitTime.y);

        float totalTime = accumulatedTime + nextEventTime;

        if (totalTime > maxTime)
            yield break;

        if(nextEventTime == nextExitTime.x) {
            int height = (leadCell.y - tailCell.y) * direction.y;
            for (int i = 0; i <= height; i++) {
                int y = tailCell.y + i * direction.y;
                yield return CastEvent.Exit(totalTime, new Vector2Int(tailCell.x, y), new Vector2Int(direction.x, 0));
            }
            tailCell.x += direction.x;
            nextExitTime.x += timeDelta.x;
        }

        if (nextEventTime == nextExitTime.y) {
            int width = (leadCell.x - tailCell.x) * direction.x;
            for (int i = 0; i <= width; i++) {
                int x = tailCell.x + i * direction.x;
                yield return CastEvent.Exit(totalTime, new Vector2Int(x, tailCell.y), new Vector2Int(0, direction.y));
            }
            tailCell.y += direction.y;
            nextExitTime.y += timeDelta.y;
        }

        if (nextEventTime == nextEntryTime.x) {
            leadCell.x += direction.x;
            int height = (leadCell.y - tailCell.y) * direction.y;
            for (int i = 0; i <= height; i++) {
                int y = tailCell.y + i * direction.y;
                yield return CastEvent.Enter(totalTime, new Vector2Int(leadCell.x, y), new Vector2Int(direction.x, 0));
            }
            nextEntryTime.x += timeDelta.x;
        }

        if (nextEventTime == nextEntryTime.y) {
            leadCell.y += direction.y;
            int width = (leadCell.x - tailCell.x) * direction.x;
            for (int i = 0; i <= width; i++) {
                int x = tailCell.x + i * direction.x;
                yield return CastEvent.Enter(totalTime, new Vector2Int(x, leadCell.y), new Vector2Int(0, direction.y));
            }
            nextEntryTime.y += timeDelta.y;
        }

        // Shift our time horizon so the most recent event is zero.
        // This avoids loss of precision in our event ordering as the time becomes large.
        accumulatedTime = totalTime;
        nextEntryTime -= nextEventTime * Vector2.one;
        nextExitTime -= nextEventTime * Vector2.one;
    }
}

```

I've shown the 2-dimensional case here, but it should be clear how to extend this to 3D if that's what you need.

Note that potentially all 4 crossing events could be the next, if they all occur at the same time stamp. That's why they're all `if` instead of some being `else if`. As long as we handle the exit events before the enter events, we don't artificially enlarge our bounding box.

One caution when adapting this code: proofread very carefully. One x that didn't get changed to a y due to a copy-paste error can easily give you wrong results or an infinite loop. (I found three such mistakes while I was drafting it) There may be opportunities to refactor some of the common operations into functions/lambdas to reduce this copy-paste risk.

This is an approximation, but it's a conservative approximation: using this, you'll never miss a collision you should have detected. When travelling diagonally, we can get into a situation where the bounding box of the circle clips a cell that the circle itself never touches, giving us a false positive. In this event, you could do some redundant collision checks inside that cell.

When the bounding box enters a row or column of multiple cells all at once, the true circle will usually enter one of those cells slightly before the others. So you'd want to check for a collision in all cells this algorithm reports as being entered at the same time stamp, to be sure you find the earliest of them.

If you need tighter precision than just the bounding box, you can buffer a range of outputs from this algorithm and perform a more detailed circle cast or ray-versus-rounded-rectangle check against each cell, and use that to reject false positives or re-order them. The algorithm above then serves as a kind of broad phase, helping you zero-in on a small set of cells that need the more expensive detailed check.

Here's an example of how we can augment the bounding box algorithm to get an exact fit:

```
// Compute how long it takes for a point particle to hit a circle at the origin.
float TimeToHitCircle(Vector2 startPosition, Vector2 velocity, float radius, out Vector2 direction, bool entering) {

    // Basic quadratic formula.
    float a = Vector2.Dot(velocity, velocity);
    float b = 2f * Vector2.Dot(startPosition, velocity);
    float c = Vector2.Dot(startPosition, startPosition) - radius * radius;

    float discriminant = b * b - 4f * a * c;

    if (discriminant < 0f) {
        direction = Vector2.zero;
        return float.NaN;
    }

    float sign = entering ? -1f : 1f;
    // TODO: There are ways to rearrange this for better numerical stability.
    float t = (-b + sign * Mathf.Sqrt(discriminant)) / (2f * a);

    if (sign * t > 0f) {
        Debug.LogErrorFormat("start {0}, vel {1}, rad {2}, entering {3}", startPosition, velocity, radius, entering);
    }

    direction = sign * (startPosition + t * velocity).normalized;
    return t;
}

// Used to maintain our sorted buffer of events.
// TODO: A heap/priority queue may handle this more efficiently.
void InsertSorted(List<CastEvent> eventBuffer, CastEvent item) {
    int index = eventBuffer.BinarySearch(item);
    if (index < 0)
        index = ~index;
    eventBuffer.Insert(index, item);
}

Vector2 OffsetFromCenterOfCell(Vector2Int cell, Vector2 position) {
    return position - gridSpacing * (cell + Vector2.one * 0.5f);
}

IEnumerator<CastEvent> CircleCastExact(Vector2 startPosition, Vector2 velocity, float radius, float maxTime = float.PositiveInfinity) {

    // Spin up our crude bounding box version to enumerate the cells we *might* touch.
    var broadPhase = CircleCastApproximate(startPosition, velocity, radius, maxTime);
    broadPhase.MoveNext();

    // Compute how much earlier/later the circle might touch a corner, compared to the square.
    // This is how much time we need to look ahead to ensure we correctly order our intersections.
    float timeError = TimeToHitCircle(new Vector2(Mathf.Sign(velocity.x), Mathf.Sign(velocity.y)) * -radius, velocity, radius, out Vector2 unused, true);

    // First, filter the initial overlaps to only the ones we actually touch.
    Vector2 halfGrid = gridSpacing * 0.5f;
    while (broadPhase.Current.time == 0) {
        var offset = OffsetFromCenterOfCell(broadPhase.Current.cell, startPosition);

        var onCell = new Vector2(
                Mathf.Clamp(offset.x, -halfGrid.x, halfGrid.x),
                Mathf.Clamp(offset.y, -halfGrid.y, halfGrid.y)
        );
        if ((offset - onCell).sqrMagnitude < radius * radius)
            yield return broadPhase.Current;
        broadPhase.MoveNext();
    }

    // We'll keep a sorted buffer of upcoming events.
    var eventBuffer = new List<CastEvent>();

    do {
        var current = broadPhase.Current;

        // As long as the next event from the broad phase is far enough past the start of our buffer,
        // then we know no undiscovered event can intervene. So it's safe to emit our earliest buffered event.
        while (eventBuffer.Count > 0 && eventBuffer[0].time + timeError <= current.time) {
            yield return eventBuffer[0];
            eventBuffer.RemoveAt(0);
        }

        // We've emptied out the events we know are in the correct order.
        // Time to take this next approximate event from the broad phase and put it in order.

        // Shift our situation so the cell we're entering/exiting is centered on the origin.
        Vector2 offset = OffsetFromCenterOfCell(current.cell, startPosition);

        // Compute our position relative to the cell center at the time our bounding box touches it.
        Vector2 positionAtTime = offset + current.time * velocity;

        // If we entered this cell horizontally, we care about our vertical alignment, and vice versa.
        Vector2 alongSide = new Vector2(current.direction.y, current.direction.x);

        // How far are we off the cell's center line at the moment of bounding box contact with its edge?
        float deviation = Mathf.Abs(Vector2.Dot(positionAtTime, alongSide));
        float limit = Mathf.Abs(Vector2.Dot(gridSpacing, alongSide)) / 2f;

        // If we're less than half the grid spacing off-center, then we've hit the edge right on time.
        if (deviation <= limit) {
            InsertSorted(eventBuffer, current);
            continue;
        }

        // Otherwise, we're sweeping past the corner, and we might hit it at a different time, or miss.

        // Shift our position again, so the corner is centered at (0, 0).
        positionAtTime -= new Vector2(Mathf.Sign(positionAtTime.x), Mathf.Sign(positionAtTime.y)) * halfGrid;

        // The time when a moving circle hits a stationary point
        // is the same as the time when a moving point hits a stationary circle.
        float addedTime = TimeToHitCircle(positionAtTime, velocity, radius, out Vector2 direction, current.entering);

        // We actually miss this cell. Discard it without adding it to our buffer.
        if (float.IsNaN(addedTime)) {
            continue;
        }

        // Adjust the timing of this event: later for entering, earlier for exiting.
        current = current.Adjust(addedTime, direction);

        // We exit cells from "before" the ray started. Ignore them.
        if(current.time > 0f)
            InsertSorted(eventBuffer, current);

    } while (broadPhase.MoveNext());

    // Our broadphase ray has terminated, now we just need to empty any events left in our queue.
    foreach(var item in eventBuffer) {
        if (item.time > maxTime)
            yield break;

        yield return item;
    }
}

```

Note that you only need to add the time error offset if you care about the "exit" events. If you just want to correctly order the cells the circle enters, then it's safe to get rid of the exit events entirely and treat the time error as zero (entrance events from the broadphase can only happen later than reported, never earlier)
> 3 votes

---
Tags: collision-detection, raycasting, voxels
---


title: Framebuffer incomplete attachment

text:
# Question
Title: Framebuffer incomplete attachment
I am creating a framebuffer in LWJGL using:

```
        framebuffer = glGenFramebuffers();
        texture = glGenTextures();
        glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
        glBindTexture(GL_TEXTURE_2D, texture);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture, 0);
        glDrawBuffers(GL_COLOR_ATTACHMENT0);

```

But `glCheckFramebufferStatus` tells me that the attachment is incomplete. What am I doing wrong? I checked several websites and I don't seem to be missing anything...?

# Answer
I assume that you want to draw into a colour attachment (the texture). Let me recommend a short look into the documentation (https://khronos.org/registry/OpenGL-Refpages/gl4/) and chapter 9 of the specification (https://www.khronos.org/registry/OpenGL/specs/gl/glspec45.core.pdf) on how framebuffers and their attachments (renderbuffers) are being set up for drawing.

Here's example code to generate a framebuffer with a single colour attachment for rendering (OpenGL 4.5, plain C, no error handling for brevity):

```
// Create the framebuffer
glCreateFramebuffers( 1, &framebuffer );
// Create a colour attachment
glCreateRenderbuffers( 1, &color_attachment );
// make room (check formats for your need)
glNamedRenderbufferStorage( color_attachment, internal_format, size_x, size_y );
// attach renderbuffer to framebuffer; just a single colour attachment
glNamedFramebufferRenderbuffer( framebuffer, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, color_attachment );
// check for completeness
if( GL_FRAMEBUFFER_COMPLETE != glCheckNamedFramebufferStatus( framebuffer, GL_FRAMEBUFFER ) {
        /* error message;*/
}

```

when needed, bind the buffer to its target with a call to:

```
glBindFramebuffer( GL_DRAW_FRAMEBUFFER, framebuffer );

```

to draw into it.

Cleanup with a call to glDeleteRenderbuffers and glDeleteFramebuffers.

Use the glNamedFramebufferParameteri and glNamedRenderbufferParameteri functions for specific adjustments.
> 0 votes

---
Tags: lwjgl
---


# Question
Title: Is there anyway to disable the script "gameplay" from running once you start the simulation?
Was following the tutorial in this video https://oxmond.com/how-to-make-multiple-copies-of-a-gameobject/ on how to duplicate object. I want to modify my code I learned from this tutorial https://www.youtube.com/watch?v=OR0e-1UBEOU&t=4178s so that the bird will increase its size proportion to the distance travel and when scale\>certain value, it break into 2 identical bird object that possess the same properties as the first one. I already did the part size increase in proportion to the distance travel. Now I create an empty game object and attach the script "explode" together with prefab of the bird object to it but how to write the proper code to carry out the function if the main bird object is destroyed then it run the code "explode" to duplicate bird?

```
   using UnityEngine;
   using UnityEngine.Assertions.Must;
   using UnityEngine.SceneManagement;

   public class Bird : MonoBehaviour

{Vector3 OldPosition;
Vector3 DistanceDifference;
float TotalDistance = 0;
Vector3 _initialPosition;
private bool _birdWasLaunched;
[SerializeField] private float _launchPower = 500;

void start()
{
    OldPosition = transform.position;

}

private void Awake()
{
    _initialPosition = transform.position;

}

    void Update()
    {

    if (_birdWasLaunched &&
             GetComponent<Rigidbody2D>().velocity.magnitude > 0.1)
    {
        DistanceDifference = transform.position - OldPosition;
        TotalDistance += DistanceDifference.magnitude;
        OldPosition = transform.position;
        transform.localScale = new Vector3(0.2f * Mathf.Abs((TotalDistance * 0.2f)), 0.2f *Mathf.Abs(TotalDistance * 0.2f) , TotalDistance*0.5f);

    }

    if (transform.position.y > 20.00 ||
        transform.position.y < -20.00 || transform.position.x > 23 || transform.position.x < -23)
    {
        string currentSceneName = SceneManager.GetActiveScene().name;
        SceneManager.LoadScene(currentSceneName);

    }
    }

void OnMouseDown()
{
    GetComponent<SpriteRenderer>().color = Color.red;

}

private void OnMouseUp()
{
    GetComponent<SpriteRenderer>().color = Color.white;
    Vector2 directionToInitialPosition = _initialPosition - transform.position;
    GetComponent<Rigidbody2D>().AddForce(directionToInitialPosition * _launchPower);
    GetComponent<Rigidbody2D>().gravityScale = 1;
    _birdWasLaunched = true;

}

private void OnMouseDrag()
{
    Vector3 newPosition =    Camera.main.ScreenToWorldPoint(Input.mousePosition);
    transform.position = new Vector3(newPosition.x, newPosition.y);

```

This the 2nd script to duplicate the bird but i'm not sure what the correct codes I have to put in if the 1st game object destroy, then it duplicate 2 bird?

```
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Explode : MonoBehaviour
{
 public GameObject Bird;

// Update is called once per frame
void Update()
{
    (if Destroy(Bird))
    GameObject BirdClone = Instantiate(Bird);
}
}

```

# Answer
> 1 votes
Your approach is not going to work. You can not duplicate an object after it was destroyed, because it doesn't exist anymore at that time.

When the original object was instantiated from a prefab, then you could instantiate that prefab again when the object gets destroyed. You could do that in the `OnDestroy` method of a script which is on the gameObject you want to duplicate on destruction. That script does of course need a reference to the original prefab. But make sure that the children don't also inherit the duplicate-on-death behavior. Otherwise the number of objects will grow exponentially until your game runs out of RAM and crashes. You can remove a script from an object by passing just that component to `Destroy`.

When you are not working with prefabs, then you could handle this in the script which causes the destruction of the gameObject (which appears to not be included in the question). Just `Instantiate` two new instances before you `Destroy` the old one.

---
Tags: unity
---


# Question
Title: How to Sync the Location After Getting Up from Ragdoll?
I am currently working on multiplayer fighting game and my game will have an anim-\>ragdoll when the player is knocked out and be able to getting up from it. My problem now is ragdoll is making my character to jitter so I have to disable Replication Movement during ragdoll and enabling it again after getting up from the ragdoll.

My problem now is I am having problem when the character is getting up after ragdoll, as soon I enabling Replication Movement again, the character is snapped back at the initial position before the ragdoll, even though I have set the character location and stuff.

Here is the bp that I set up the location and stuff

This is how I enabling back the replication movement after Getting Up anim is complete and this is where the problem exist.

I tried to set the location back to the current meshlocation that I recorded during the ragdoll mode which is run on tick but still the problem persist. Any ideas or suggestion for another approach to handle this? Thanks!

# Answer
> 0 votes
Of course I will finally found a workaround after several hours of this question is posted. Almost a month trying to figure out how to solve it, I just found out that these two booleans exist that I managed to sync my character movement across all clients. I don't have to disable replication movement whatsoever. You can basically utilize this details on any ragdoll function in my opinion.

---
Tags: multiplayer, unreal-4, blueprints, synchronization, ragdoll
---


# Question
Title: Different textures inside and outside a cube in DirectX 11
I want different textures for the outside and inside of a box (cube).
The image below shows what I want to achieve. It is kind of an open box, where we can see a different texture inside:

I was trying to solve it by checking whether the normal of the face is point towards the view or to inside the screen, that is we are seeing the "back" of the face.

I was also looking into cube mapping, but it does not seem to be the way.

What method should I use to achieve that result?

# Answer
> 2 votes
Following @DMGregory suggestion, I set the pixel shader as:

```
float4 PS(PS_INPUT input, bool isFrontFace : SV_IsFrontFace) : SV_Target
{
    float4 color = 0;

    if(isFrontFace)
        color = texWood.Sample(samLinear, input.Tex);
    else
        color = texRock.Sample(samLinear, input.Tex);

    return color * vMeshColor;
}

```

Then I got the intended result:

But there is one thing that I am not understanding. It seems that `SV_IsFrontFac` is giving me the inverted value of what I would expect from it. By looking to my PS code you will notice that I had to set the wood colour when `isFrontFace` is `true` and rock colour when is `false`. I already checked if the textures are assigned properly to the `Texture2D` variable.

# Answer
> 0 votes
You can only put materials on one side of any given object unless you are using shaders which specifically render backfaces. Because of backface culling being one of the simplest and fastest graphics optimizations, it is always assumed that you will be viewing meshes from one side only!

For what you want to do here, I would have **two cubes- one with the normals pointing out, and one with the normals pointing in**. You'll have to use some external application to make the 'inside-out' one, because Unity does not normally provide that kind (Blender/Maya).

You could always **build a texture shader and use Cull Off/Cull Front/Cull Back** to achieve the same result nonetheless.

```
 Shader "Show Insides" {
   SubShader {

     Tags { "RenderType" = "Opaque" }

     Cull Front

     CGPROGRAM

     #pragma surface surf Lambert vertex:vert

     void vert(inout appdata_full v)
     {
         v.normal.xyz = v.normal * -1;
     }

     struct Input {
         float4 color : COLOR;
     };

     void surf (Input IN, inout SurfaceOutput o) {
         o.Albedo = 1;
     }

     ENDCG

   }

   Fallback "Diffuse"
}

```

---
Tags: textures, graphics, directx11
---


# Question
Title: Adding a delay into the middle of a function in Unity
In the spot `//wait 1.5 seconds` what would I say to make it wait 1.5 seconds then complete the code after?

Here is the code:

```
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class OnclickHeal : MonoBehaviour
{
    public PlayerHealth playerHealth;
    public PlayerMovement playerMovement;
    public Inventory Inventory;

    public Button healButton;

    void Start()
    {
        Button btn = healButton.GetComponent<Button>();
        btn.onClick.AddListener(TaskOnClick);
    }

    void TaskOnClick()
    {
        playerMovement.moveSpeed = 3;
        //wait 1.5 seconds
        playerMovement.moveSpeed = 4;
        playerHealth.currentHealth = 100;
    }
}

```

Also, the line `public Button healButton;` throws an error:

> error CS0246: The type or namespace name 'Button' could not be found (are you missing a using directive or an assembly reference?)

# Answer
> 0 votes
Use the Invoke() function to call a function after a certain delay

```
Invoke("DoSomething", 1.5);//this will happen after a delay of 1.5 seconds

```

Where DoSomething is the name of the function that can be defined arbitrarily

```
void DoSomething() {
  //do nothing
  return;
}

```

If you want to read up on more documentation and how you can make better use of them than my naive approach, you can search for *Unity Invoke()* and *Invoke Co-routines*(DoSomething is a co-routine in the above example).

# Answer
> 1 votes
This is what Coroutines are for. A coroutine allows you to execute a method with breaks while the rest of the game continues running.

When you have a series of actions which are supposed to be executed with breaks, move them into a method which returns an IEnumerator.

You can now use the construct `yield return WaitForSeconds(1.5f);` in that method to add breaks to this method.

In order for these breaks to work, you have to run it as a coroutine with the method `StartCoroutine(MethodName())`.

```
void TaskOnClick() {
    StartCoroutine(ChangeMoveSpeed());
}

private IEnumerator ChangeMoveSpeed() {
    playerMovement.moveSpeed = 3;
    yield return WaitForSeconds(1.5f);
    playerMovement.moveSpeed = 4;
    playerHealth.currentHealth = 100;
}

```

---
Tags: unity, c#
---


# Question
Title: My own game disappears after installation on Google play store
I have a problem where I just installed my own game I made into my phone, but however my game just appears to be not be openable it just shows one button "Uninstall", instead of open. I do however saw that my app appears to be hidden in my phone app settings. Did I did something wrong? I used Android studio to make my signed APK or AAB game. For this published game it is a AAB. Is that bad?

# Answer
Based on the screenshot you've posted of your Manifest, it looks like you don't have any activities on your project. Activities are individual "screens" that can be launched to display content on the screen, on Android.

To add an Activity on Android Studio, you can navigate to `File` -\> `New` -\> `Activity`. The UI will guide you through the process. This will also update your Manifest automatically, so outside programs (including the Play Store) will know how to launch your app.

Apart from that, you also need a Default Activity. In an app that includes many Activities, this will determine which one should open when a user launches your app. The usual syntax in the Manifest looks like this:

```
<activity android:name=".MyAppActivity">
<intent-filter>
    <action android:name="android.intent.activity.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

```

What Activities are and how to take fully advantage of them is a very big discussion, that can't fit into one answer here. To read more about it you can read more on Android Developers - Introduction to Activities.
> 0 votes

---
Tags: android
---


title: How does orbital math work?

text:
# Question
Title: How does orbital math work?
I'm writing a 2d space game, and I want the players to be able to 'orbit' objects and other players (if they're fast enough, of course), but I'm having trouble coming up with the right way to think about this physically (I never took physics, so this part is hard for me).

Note that this is not a 'realistic' space sim -- more like boats, really, so I don't want to do this by having the objects actually have enough gravity to force the orbit normally, because that'll make players that didn't press the 'orbit' button get sucked in and not be fun.

Also, do note that the objects players are trying to orbit may themselves be trying to orbit another object or even be mutual orbits.

I'm using the RK4 integrator right now, though if that needs to change, I'm totally up for it.

# Answer
> 6 votes
When the user presses the "orbit" button, store the vector between the ship and the planet. On every update, change the vector's *angle* leaving *magnitude the same* and then update the ships position by adding the planets position and the vector pointing at the ships new position. This will create the effect of the ship moving in a uniform circle around the object being orbited.

Also, it would be a nice touch if you programmed the ship to slowly turn until it was pointed 90 degrees to the planet before starting the uniform orbit, otherwise the ship could be going straight toward it then sharply turn into orbit when the user presses the button.

## More Detailed Physics

If you want more complicated things like true elliptical orbits and correct orbital speeds, you will need to do some research into real physics.

This question has already been asked: https://stackoverflow.com/questions/4038554/2d-orbital-physics; But for those that find this page, I will summarize the results and try to apply it to your situation and somewhat explain the physics.

His engine uses the following equation to calculate the force applied on both objects, where `F` is the force, `G` is the gravitational constant, `m` and `M` are the masses of the two objects, and finally `r` is the radius.

```
F = G M m / r^2

```

Remember that Newton's Third Law says that "all forces between two objects exist in equal magnitude and opposite direction", meaning that this equation is evaluated once and represents both forces present.

In addition, his pseudo code for his engine might be helpful:

```
for each time step of length t:
  reset cumulative forces on each object to 0.
  for each unique pair of objects:
    calculate force between them due to gravity.
    accumulate force to the two objects.
  for each object:
    calculate velocity change dV for this timestep using Ft / m.
    v = v + dV.
    calculate position change dS using v * t.
    s = s + dS.

```

Also, he discovered that he needed to normalize the direction vector before he applied it to the force.

# Answer
> 2 votes
If you need just a circular obit, use the method below, where the parameter "c" is the center position of the orbit, "t" is the vector in which the object will circulate around, I call it torque, "theta" is the angular displacement. On a 2d plane omit the z coordinate and change the vectors to 2d.

```
public void orbit(Vector3f c, Vector3f t, float theta) {

        //normalize t
        t = t.normalize();

        float orbitAngleRad = (float) Math.toRadians(theta);

        double sinTheta = Math.sin(orbitAngleRad);
        double cosTheta = Math.cos(orbitAngleRad);

        Vector3f p0 = this.getPosition();
        float x0 = p0.x;
        float y0 = p0.y;
        float z0 = p0.z;

        float x = (float) ((c.x*(t.y*t.y + t.z*t.z) - t.x*(c.y*t.y + c.z*t.z - t.dot(p0)))*(1-cosTheta)
                + x0*cosTheta + (-c.z*t.y + c.y*t.z - t.z*y0 + t.y*z0)*sinTheta);

        float y = (float) ((c.y*(t.x*t.x + t.z*t.z) - t.y*(c.x*t.x + c.z*t.z - t.dot(p0)))*(1-cosTheta)
                + y0*cosTheta + (c.z*t.x - c.x*t.z + t.z*x0 - t.x*z0)*sinTheta);

        float z = (float) ((c.z*(t.x*t.x + t.y*t.y) - t.z*(c.x*t.x + c.y*t.y - t.dot(p0)))*(1-cosTheta)
                + z0*cosTheta + (-c.y*t.x + c.x*t.y - t.y*x0 + t.x*y0)*sinTheta);

        //move the center point of the object
        this.setPosition(x,y,z);
        //this line is for construct the standard rotation matrix, this will rotate the center of the object
        this.getRotation().rotateAxis(orbitAngleRad, t);

    }

```

---
Tags: 2d, physics, orbit
---


# Question
Title: Make a GameObject Constantly Appear and Disappear
I am making a game where I need these black rings to appear and disappear one after another. I am in Unity 2D so what I did is simply changed their Z transform. I am also trying to run this code asynchronously so that it doesn't choke up and slow down when I am running other things in the main `Update`. Right now when I run the game, all the other things happen perfectly in sync but the rings don't turn on and off in sync and then after all the other game objects have stopped moving, they start blinking rapidly and chaotically. How do I fix this?

My code:

using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;

public class ring1 : MonoBehaviour
{
    // Start is called before the first frame update
    public GameObject ring;
    public GameObject ring2;
    public GameObject ring3;
    public GameObject ring4;
    private bool isCoroutineExecuting = false;
    async void Start()
    {
        ring.GetComponent<GameObject>();
        ring2.GetComponent<GameObject>();
        ring3.GetComponent<GameObject>();
        ring4.GetComponent<GameObject>();
    }

    // Update is called once per frame
    void Update()
    {

    }

    void FixedUpdate()
    {
        //ring.transform.position = new Vector3(ring.transform.position.x, ring.transform.position.y, 0);
        //WaitForSeconds(1);
        //ring.transform.position = new Vector3(ring.transform.position.x, ring.transform.position.y, 100);

        //print("fixed");
        StartCoroutine(ExampleCoroutine());
    }

    IEnumerator ExampleCoroutine()
    {
        //Print the time of when the function is first called.
        Debug.Log("Started Coroutine at timestamp : " + Time.time);

        ring.transform.position = new Vector3(ring.transform.position.x, ring.transform.position.y, 0);
        ring2.transform.position = new Vector3(ring2.transform.position.x, ring2.transform.position.y, 0);
        ring3.transform.position = new Vector3(ring3.transform.position.x, ring3.transform.position.y, 0);
        ring4.transform.position = new Vector3(ring4.transform.position.x, ring4.transform.position.y, 0);

        ring.transform.position = new Vector3(ring.transform.position.x, ring.transform.position.y, 100);
        yield return new WaitForSeconds(1);
        ring2.transform.position = new Vector3(ring2.transform.position.x, ring2.transform.position.y, 100);
        yield return new WaitForSeconds(1);
        ring3.transform.position = new Vector3(ring3.transform.position.x, ring3.transform.position.y, 100);
        yield return new WaitForSeconds(1);
        ring4.transform.position = new Vector3(ring4.transform.position.x, ring4.transform.position.y, 100);
        yield return new WaitForSeconds(1);

        //After we have waited 5 seconds print the time again.
        Debug.Log("Finished Coroutine at timestamp : " + Time.time);
    }
}

```
</code></pre>

# Answer
> 2 votes
You can simplify this code a lot.

* You're not using threading, so `using System.Threading;` is unnecessary.
* `GetComponent<GameObject>()` is meaningless. `GameObject` is not a kind of `Component`. You don't need to "warm up" a game object reference by calling a special method on it. It's already a valid game object reference without calling this method.
* Your `Update` method is empty. If you're not using it, delete it.
* You're starting a *new copy* of your Coroutine every single physics step. This is *NOT* what you want to do.

Here's a much simpler script that turns the rings on one after another.

```
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RingAlternator : MonoBehaviour
{
    // If you want to do the same thing to a series of numbered variables,
    // just make an array and access them by index.
    public GameObject[] rings;

    // If we want one instance of a coroutine to fire when the object is activated,
    // we can just make the Start function a coroutine itself.
    IEnumerator Start()
    {
        // Loop this sequence forever.
        while (true) {
            // Make all rings disappear.
            foreach (var ring in rings) {
                ring.SetActive(false);
            }

            // Enable the rings one by one in order, then wait a second after each.
            foreach (var ring in rings) {
                ring.SetActive(true);
                yield return new WaitForSeconds(1);
            }
        }
    }
}

```

---
Tags: unity, c#
---


# Question
Title: Accelerometer input for player movement is too sensitive
I am designing an endless runner style game like temple run. I need to move the player left and right based on the accelerometer input (tilting). The problem is that the accelerometer input is very sensitive. In other words the player is moving left even if the phone is held straight. I want to make the player to move smoothly like temple run game. (Player has a `Rigidbody` component attached to him.). Here is my initial code:

```
if (Input.acceleration.x < 0)
{
    this.transform.Translate(-0.3f, 0, 0);
}
else if (Input.acceleration.x > 0)
{
    this.transform.Translate(-0.3f, 0, 0);
}

```

Then I tried:

```
// Player is running in negative direction
// Input.acceleration > 0 moves the player right
if (Input.acceleration.x < -0.2)
        {
            // this.transform.Translate(-0.3f, 0, 0);
            Vector3 dir = Vector3.zero;
            dir.x = Input.acceleration.x;
            if(dir.sqrMagnitude > 1)
            {
                dir.Normalize();
            }
            dir = dir * Time.deltaTime * horizontalMoveSpeed;
            transform.Translate(dir.x, 0 ,0 );
        }

        else if (Input.acceleration.x > 0.2)
        {
            // this.transform.Translate(0.3f, 0, 0);
            Vector3 dir = Vector3.zero;
            dir.x = Input.acceleration.x;
            if (dir.sqrMagnitude > 1)
            {
                dir.Normalize();
            }
            dir = dir * Time.deltaTime * horizontalMoveSpeed;
            transform.Translate(-dir.x, 0, 0);
        }

```

The problem in the edited new code is that the player moves only to the left even if the phone is tilted right. What is the mistake in my code?

I know that this question will get lots of down votes because this is a basic question. But unfortunately I am new to Unity and I cannot figure it out. What is the mistake?

# Answer
Presumably you considered adding a window of tolerance into your check?

```
// Expose this in the Inspector so you can tune it to a value that feels good.
public float noTiltWindow = 0.2f;

// ... then later, in your movement function:

if (Input.acceleration.x < -noTiltWindow)
{
    transform.Translate(-0.3f, 0, 0);
}
else if (Input.acceleration.x > noTiltWindow)
{
    transform.Translate(+0.3f, 0, 0);
}

```

Or, equivalently:

```
if(Mathf.Abs(Input.acceleration.x) > noTiltWindow) {
    transform.Translate(Mathf.Sign(Input.acceleration.x) * 0.3f, 0f, 0f);
}

```

With this code, small jitter or bias in the accelerometer value won't be detected as leftward or rightward movement until you tilt your phone far enough to overcome the threshold.

Other ways you can improve this code:

* Make the movement speed proportional to the amount of tilt, so the player gets a little warning when they're close to the threshold, before they start moving the wrong way at full speed.
* Use `Input.gyro.attitude` or `Input.gyro.gravity` instead of `Input.acceleration`. This uses the phone's various sensors in tandem to compensate for errors or weaknesses in the accelerometer alone.
> 0 votes

# Answer
I used have used a Queue (or some other kind of circular array) to solve this problem before. You store a set number of “raw” previous values and average these values to come to the current value. Combined with the thresholds described in @DMGregory ‘s answer, this worked pretty well for me.

It takes a bit of trial and error to find the correct queue length.

The thresholds min and max movement get rid of a lot of the small jitters and instability. The averaged queue smooths the motion so you dont get big jumps.

Note that if the queue length is long, you’ll get what seems to be lag.
> 0 votes

---
Tags: unity, c#, accelerometer
---


# Question
Title: How do I rotate a sphere so that a position on it comes to a specific location?
Sorry for my english. I added a picture to explain what i want. I want rotate Big Sphere to make the black point locate in front of camera. (to the white point's position) not black point moving, whole sphere moving.

or is it better to move camera to black point?

which API should i use?

# Answer
> 1 votes
You have the vector that goes from the center of the sphere to the camera, let us call it `a`. That should be `a = camera.transform.position - sphere.transform.position;`.

Similarly you have the vector that goes from the center of the sphere to black spot, let us call it `b`. *I have no clue how you defined this one, I'll trust you have the vector.*

You need to rotate the sphere in such way that `b` lines up with `a`. That is, you need to rotate in the plane defined by the center of the sphere and the vectors `a` and `b`. And the angle you need to rotate is the angle between `a` and `b`.

It seems natural to use an axis-angle representation. We need the angle between `a` and `b`, and a vector perpendicular to both to act as rotation axis.

Getting the angle between two vectors is easy, you call `Vector3.Angle`. And for the axis, we can use cross product, you call `Vector3.Cross`.

Now you can create a quaternion from angle-axis by calling `Quaternion.AngleAxis` and that would be a rotation that lines up your vectors.

It looks like this:

```
var angle = Vector3.Angle(a, b);
var axis = Vector3.Cross(a, b);
var rotation = Quaternion.AngleAxis(angle, axis);

```

And you need to compose that rotation with the current transform rotation (that is quaternion multiplication).

Alternatively, you can use `Transform.RotateAround`:

```
sphere.transform.RotateAround(sphere.transform.position, axis, angle);

```

---

A little caveat: I don't know if it will line them up such that the black point goes to the camera or away from it. I believe it depends on whatever or not the black point is roughly in the direction of the camera to begin with or not.

You can use the sign dot product to check if the vectors are looking roughly in the same direction (call `Vector3.Dot`). A positive dot product means the vectors are roughly in the same direction (the way I have described it, you want `a` and `b` going the same direction).

You can invert the rotation if needed (based on the check of the sing of the dot product). There are many ways to create the inverted rotation, including using the negative of the angle or the axis in `AngleAxis`, or `Quaternion.Inverse`.

# Answer
> 0 votes
you can use Quaternion.FromToRotation it is someting like this

transform.rotation = Quaternion.FromToRotation(startRotation, desiredRotation);

Have a nice day

# Answer
> 0 votes
If you're trying to *animate* the sphere in the way you described, you need to interpolate between the two rotations. I haven't tried this, so you'll have to experiment on your own, but, you should be able to use Quaternion.Lerp or Quaternion.Slerp to achieve this.

Slerp (sphericall interpolation), for example, takes in two quaternions - one representing the initial rotation, and another one representing the target rotation:

```
Quaternion Slerp(Quaternion initial, Quaternion final, float t);

```

The `t` parameter ranges from 0 - initial rotation, to 1 - final rotation.

Assuming the sphere is untransformed (not rotated) to begin with, you can use `Quaternion.identity` as the initial rotation, otherwise, use `transform.localRotation`, where `transform` is the sphere's transform.

Since your point on the sphere is represented by a vector, you can use Quaternion.FromToRotation to get the quaternion representing the final rotation.

```
Quaternion FromToRotation(Vector3 fromDirection, Vector3 toDirection);

```

This will produce a rotation that, when applied to the sphere, reorients your point so that it's "looking" in the `toDirection`.

> the black point is Vector3 in world space

The `fromDirection` and `toDirection` vectors need to be expressed in (sphere's) local space (unless your sphere happens to sit at \[0, 0, 0\]). To get a vector in local space, just subtract (vector in world space) - (sphere's location).

The `toDirection` is just (camera location) - (sphere's location). I'm not sure if you need to normalize these vectors (probably not).

Finally, you'd apply the interpolation over time; you'll have to calculate `t` so that it reaches 1 after your desired animation time has elapsed:

```
elapsedAnimTime += deltaTime;
float t = elapsedAnimTime / desiredTotalAnimTime;
transform.localRotation = Quaternion.Slerp(initial, final, t);

```

Note that you'll (probably) have to put in some conditions to stop animating after `t` reaches 1.

Because it's a quaternion, it should reorient your sphere using the "shortest path" (it won't go through some weird angle).

---
Tags: unity, quaternion, rotate
---


# Question
Title: How to find a culprit BP from memory address in VS debugger causing build error messages in UE4?
I am trying to build out my project, but I keep running into a nasty error message about a BP reroute node... :(

It compiles all of the 1000 shaders and everything and just before it would finish it spits out all these messages below :(

Can't figure out how to find the guilty BP reroute node...

UPDATE:

Managed to catch the error in VS debugger, because the error was coming up on editor startup as well.

Does anyone know how do I find the bp node from this:-

```
ToPin   0x00000213399e1e40 {OwningNode=0x0000021339a09520 (Name=K2Node_Knot_2) PinId={6E845E73-4C10-5543-66DF-808C194A79BE} ...}    UEdGraphPin *
+       OwningNode  0x0000021339a09520 (Name=K2Node_Knot_2) UEdGraphNode * {UE4Editor-BlueprintGraph.dll!UK2Node_Knot}
+       PinId   {6E845E73-4C10-5543-66DF-808C194A79BE}  FGuid
+       PinName InputPin    FName
+       Direction   EGPD_Input (0)  TEnumAsByte<enum EEdGraphPinDirection>
        bHidden 0 '\0'  unsigned char
        bNotConnectable 0 '\0'  unsigned char
        bDefaultValueIsReadOnly 0 '\0'  unsigned char
        bDefaultValueIsIgnored  1 '\x1' unsigned char
        bIsDiffing  0 '\0'  unsigned char
        bAdvancedView   0 '\0'  unsigned char
        bDisplayAsMutableRef    0 '\0'  unsigned char
        bOrphanedPin    0 '\0'  unsigned char
        bSavePinIfOrphaned  1 '\x1' unsigned char
        bUseBackwardsCompatForEmptyAutogeneratedValue   0 '\0'  unsigned char
        bWasTrashed 0 '\0'  unsigned char
+       PinFriendlyName Empty   FText
+       PinToolTip  Empty   FString
+       PinType {PinCategory=string PinSubCategory=None PinSubCategoryObject=nullptr ...}   FEdGraphPinType
+       DefaultValue    Empty   FString
+       AutogeneratedDefaultValue   Empty   FString
+       DefaultObject   0x0000000000000000 <NULL>   UObject *
+       DefaultTextValue    Empty   FText
+       LinkedTo    Num=1   TArray<UEdGraphPin *,TSizedDefaultAllocator<32>>
+       SubPins Empty   TArray<UEdGraphPin *,TSizedDefaultAllocator<32>>
+       ParentPin   0x0000000000000000 <NULL>   UEdGraphPin *
+       ReferencePassThroughConnection  0x0000000000000000 <NULL>   UEdGraphPin *
+       PersistentGuid  {00000000-0000-0000-0000-000000000000}  FGuid
+       ToPin->LinkedTo Num=1   TArray<UEdGraphPin *,TSizedDefaultAllocator<32>>
+       this    0x00000213399d2c00 {OwningNode=0x0000021339a098a0 (Name=K2Node_Knot_2) PinId={2F8E76BD-479D-C97B-4820-F5A1EB362139} ...}    UEdGraphPin *

```

```
LogOutputDevice: Error: === Handled ensure: ===
LogOutputDevice: Error: Ensure condition failed: MyNode->GetOuter() == ToPin->GetOwningNode()->GetOuter() [File:E:/UE4EngineBuilds/UE4dqsmod/Engine/Source/Runtime/Engine/Private/EdGraph/EdGraphPin.cpp] [Line: 450]
LogOutputDevice: Error: UEdGraphPin::MakeLinkTo Pin 'InputPin' on node 'Reroute Node' has a different outer than pin 'OutputPin' on node 'Reroute Node'
LogOutputDevice: Error: Stack:
LogOutputDevice: Error: [Callstack] 0x00007ffb4872b217 UE4Editor-Engine.dll!DispatchCheckVerify<bool,<lambda_1891a4392d75b7f5d2bf8cae7bcc3de6> >() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\Core\Public\Misc\AssertionMacros.h:161]
LogOutputDevice: Error: [Callstack] 0x00007ffb474e9f8a UE4Editor-Engine.dll!UEdGraphPin::MakeLinkTo() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\Engine\Private\EdGraph\EdGraphPin.cpp:450]
LogOutputDevice: Error: [Callstack] 0x00007ffb4123e7b1 UE4Editor-BlueprintGraph.dll!UEdGraphSchema_K2::CombineTwoPinNetsAndRemoveOldPins() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\BlueprintGraph\Private\EdGraphSchema_K2.cpp:6856]
LogOutputDevice: Error: [Callstack] 0x00007ffb4123dce4 UE4Editor-BlueprintGraph.dll!UEdGraphSchema_K2::CollapseGatewayNode() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\BlueprintGraph\Private\EdGraphSchema_K2.cpp:6764]
LogOutputDevice: Error: [Callstack] 0x00007ffb3d2d6b38 UE4Editor-KismetCompiler.dll!FKismetCompilerContext::ExpandTunnelsAndMacros() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\KismetCompiler\Private\KismetCompiler.cpp:3705]
LogOutputDevice: Error: [Callstack] 0x00007ffb3d2d6f5f UE4Editor-KismetCompiler.dll!FKismetCompilerContext::ExpansionStep() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\KismetCompiler\Private\KismetCompiler.cpp:3113]
LogOutputDevice: Error: [Callstack] 0x00007ffb3d2ee5eb UE4Editor-KismetCompiler.dll!FKismetCompilerContext::ProcessOneFunctionGraph() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\KismetCompiler\Private\KismetCompiler.cpp:3747]
LogOutputDevice: Error: [Callstack] 0x00007ffb3d2bd35b UE4Editor-KismetCompiler.dll!FKismetCompilerContext::CreateFunctionList() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\KismetCompiler\Private\KismetCompiler.cpp:3866]
LogOutputDevice: Error: [Callstack] 0x00007ffb2f387965 UE4Editor-UMGEditor.dll!FWidgetBlueprintCompilerContext::CreateFunctionList() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\UMGEditor\Private\WidgetBlueprintCompiler.cpp:117]
LogOutputDevice: Error: [Callstack] 0x00007ffb3d2ad417 UE4Editor-KismetCompiler.dll!FKismetCompilerContext::CompileClassLayout() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\KismetCompiler\Private\KismetCompiler.cpp:4072]
LogOutputDevice: Error: [Callstack] 0x00007ffb42ffc407 UE4Editor-Kismet.dll!FBlueprintCompilationManagerImpl::FlushCompilationQueueImpl() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\Kismet\Private\BlueprintCompilationManager.cpp:1212]
LogOutputDevice: Error: [Callstack] 0x00007ffb42ff9d43 UE4Editor-Kismet.dll!FBlueprintCompilationManager::FlushCompilationQueue() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\Kismet\Private\BlueprintCompilationManager.cpp:3020]
LogOutputDevice: Error: [Callstack] 0x00007ffb463dc750 UE4Editor-CoreUObject.dll!FScopedClassDependencyGather::~FScopedClassDependencyGather() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\Blueprint\BlueprintSupport.cpp:442]
LogOutputDevice: Error: [Callstack] 0x00007ffb465e0911 UE4Editor-CoreUObject.dll!FLinkerLoad::CreateExport() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:4578]
LogOutputDevice: Error: [Callstack] 0x00007ffb46607caa UE4Editor-CoreUObject.dll!FLinkerLoad::IndexToObject() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:4811]
LogOutputDevice: Error: [Callstack] 0x00007ffb465df36b UE4Editor-CoreUObject.dll!FLinkerLoad::CreateExport() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:4185]
LogOutputDevice: Error: [Callstack] 0x00007ffb465e0dfb UE4Editor-CoreUObject.dll!FLinkerLoad::CreateExportAndPreload() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:3233]
LogOutputDevice: Error: [Callstack] 0x00007ffb46608dce UE4Editor-CoreUObject.dll!FLinkerLoad::LoadAllObjects() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:3397]
LogOutputDevice: Error: [Callstack] 0x00007ffb4674c6cd UE4Editor-CoreUObject.dll!LoadPackageInternal() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1312]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664c46d UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImportInner() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2861]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664ab43 UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImport() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2583]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664c69e UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImportInner() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2927]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664ab43 UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImport() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2583]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664a406 UE4Editor-CoreUObject.dll!FLinkerLoad::Verify() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2355]
LogOutputDevice: Error: [Callstack] 0x00007ffb465eef09 UE4Editor-CoreUObject.dll!FLinkerLoad::FinalizeCreation() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2257]
LogOutputDevice: Error: [Callstack] 0x00007ffb466485af UE4Editor-CoreUObject.dll!FLinkerLoad::Tick() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:790]
LogOutputDevice: Error: [Callstack] 0x00007ffb465e2f91 UE4Editor-CoreUObject.dll!FLinkerLoad::CreateLinker() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:459]
LogOutputDevice: Error: [Callstack] 0x00007ffb465fbe29 UE4Editor-CoreUObject.dll!GetPackageLinker() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\Linker.cpp:745]
LogOutputDevice: Error: [Callstack] 0x00007ffb4674c360 UE4Editor-CoreUObject.dll!LoadPackageInternal() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1208]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664c46d UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImportInner() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2861]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664ab43 UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImport() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2583]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664c69e UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImportInner() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2927]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664ab43 UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImport() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2583]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664a406 UE4Editor-CoreUObject.dll!FLinkerLoad::Verify() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2355]
LogOutputDevice: Error: [Callstack] 0x00007ffb465eef09 UE4Editor-CoreUObject.dll!FLinkerLoad::FinalizeCreation() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2257]
LogOutputDevice: Error: [Callstack] 0x00007ffb466485af UE4Editor-CoreUObject.dll!FLinkerLoad::Tick() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:790]
LogOutputDevice: Error: [Callstack] 0x00007ffb465e2f91 UE4Editor-CoreUObject.dll!FLinkerLoad::CreateLinker() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:459]
LogOutputDevice: Error: [Callstack] 0x00007ffb465fbe29 UE4Editor-CoreUObject.dll!GetPackageLinker() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\Linker.cpp:745]
LogOutputDevice: Error: [Callstack] 0x00007ffb4674c360 UE4Editor-CoreUObject.dll!LoadPackageInternal() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1208]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664c46d UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImportInner() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2861]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664ab43 UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImport() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2583]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664c69e UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImportInner() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2927]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664ab43 UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImport() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2583]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664a406 UE4Editor-CoreUObject.dll!FLinkerLoad::Verify() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2355]
LogOutputDevice: Error: [Callstack] 0x00007ffb465eef09 UE4Editor-CoreUObject.dll!FLinkerLoad::FinalizeCreation() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2257]
LogOutputDevice: Error: [Callstack] 0x00007ffb466485af UE4Editor-CoreUObject.dll!FLinkerLoad::Tick() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:790]
LogOutputDevice: Error: [Callstack] 0x00007ffb465e2f91 UE4Editor-CoreUObject.dll!FLinkerLoad::CreateLinker() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:459]
LogOutputDevice: Error: [Callstack] 0x00007ffb465fbe29 UE4Editor-CoreUObject.dll!GetPackageLinker() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\Linker.cpp:745]
LogOutputDevice: Error: [Callstack] 0x00007ffb4674c360 UE4Editor-CoreUObject.dll!LoadPackageInternal() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1208]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664c46d UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImportInner() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2861]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664ab43 UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImport() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2583]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664c69e UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImportInner() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2927]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664ab43 UE4Editor-CoreUObject.dll!FLinkerLoad::VerifyImport() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2583]
LogOutputDevice: Error: [Callstack] 0x00007ffb4664a406 UE4Editor-CoreUObject.dll!FLinkerLoad::Verify() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2355]
LogOutputDevice: Error: [Callstack] 0x00007ffb465eef09 UE4Editor-CoreUObject.dll!FLinkerLoad::FinalizeCreation() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:2257]
LogOutputDevice: Error: [Callstack] 0x00007ffb466485af UE4Editor-CoreUObject.dll!FLinkerLoad::Tick() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:790]
LogOutputDevice: Error: [Callstack] 0x00007ffb465e2f91 UE4Editor-CoreUObject.dll!FLinkerLoad::CreateLinker() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp:459]
LogOutputDevice: Error: [Callstack] 0x00007ffb465fbe29 UE4Editor-CoreUObject.dll!GetPackageLinker() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\Linker.cpp:745]
LogOutputDevice: Error: [Callstack] 0x00007ffb4674c360 UE4Editor-CoreUObject.dll!LoadPackageInternal() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1208]
LogOutputDevice: Error: [Callstack] 0x00007ffb4674b7a0 UE4Editor-CoreUObject.dll!LoadPackage() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1427]
LogOutputDevice: Error: [Callstack] 0x00007ffb4478ef1a UE4Editor-UnrealEd.dll!UEditorEngine::Map_Load() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\UnrealEd\Private\EditorServer.cpp:2619]
LogOutputDevice: Error: [Callstack] 0x00007ffb4477dd2f UE4Editor-UnrealEd.dll!UEditorEngine::HandleMapCommand() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\UnrealEd\Private\EditorServer.cpp:6167]
LogOutputDevice: Error: [Callstack] 0x00007ffb44765db1 UE4Editor-UnrealEd.dll!UEditorEngine::Exec() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\UnrealEd\Private\EditorServer.cpp:5647]
LogOutputDevice: Error: [Callstack] 0x00007ffb44fbb177 UE4Editor-UnrealEd.dll!UUnrealEdEngine::Exec() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\UnrealEd\Private\UnrealEdSrv.cpp:697]
LogOutputDevice: Error: [Callstack] 0x00007ffb44ae5272 UE4Editor-UnrealEd.dll!FEditorFileUtils::LoadMap() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\UnrealEd\Private\FileHelpers.cpp:2561]
LogOutputDevice: Error: [Callstack] 0x00007ffb44ae5074 UE4Editor-UnrealEd.dll!FEditorFileUtils::LoadDefaultMapAtStartup() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\UnrealEd\Private\FileHelpers.cpp:3950]
LogOutputDevice: Error: [Callstack] 0x00007ffb44ff65b6 UE4Editor-UnrealEd.dll!FUnrealEdMisc::OnInit() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\UnrealEd\Private\UnrealEdMisc.cpp:361]
LogOutputDevice: Error: [Callstack] 0x00007ffb44fb6ed3 UE4Editor-UnrealEd.dll!EditorInit() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\UnrealEd\Private\UnrealEdGlobals.cpp:114]
LogOutputDevice: Error: [Callstack] 0x00007ff6a66fb859 UE4Editor.exe!GuardedMain() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\Launch\Private\Launch.cpp:149]
LogOutputDevice: Error: [Callstack] 0x00007ff6a66fbaba UE4Editor.exe!GuardedMainWrapper() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:137]
LogOutputDevice: Error: [Callstack] 0x00007ff6a670e28d UE4Editor.exe!WinMain() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:268]
LogOutputDevice: Error: [Callstack] 0x00007ff6a67113ba UE4Editor.exe!__scrt_common_main_seh() [D:\agent\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
LogOutputDevice: Error: [Callstack] 0x00007ffb8aac7034 KERNEL32.DLL!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffb8ac9cec1 ntdll.dll!UnknownFunction []

```

And these are in the log file:

```
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000018

0x00007ffb47d6a9a4 UE4Editor-Engine.dll!FSkeletalMeshRenderData::Cache() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\Engine\Private\SkeletalMeshRenderData.cpp:307]
0x00007ffb47cde080 UE4Editor-Engine.dll!USkeletalMesh::CacheDerivedData() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\Engine\Private\SkeletalMesh.cpp:3440]
0x00007ffb47d12a1d UE4Editor-Engine.dll!USkeletalMesh::PostLoad() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\Engine\Private\SkeletalMesh.cpp:2518]
0x00007ffb4666b80e UE4Editor-CoreUObject.dll!UObject::ConditionalPostLoad() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\Obj.cpp:1067]
0x00007ffb4673d08b UE4Editor-CoreUObject.dll!EndLoad() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1592]
0x00007ffb46727797 UE4Editor-CoreUObject.dll!<lambda_d7afe02bf9c460bdfe082586fba5c066>::operator()() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1231]
0x00007ffb4674c81b UE4Editor-CoreUObject.dll!LoadPackageInternal() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1332]
0x00007ffb4674b7a0 UE4Editor-CoreUObject.dll!LoadPackage() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1427]
0x00007ffb44594f6d UE4Editor-UnrealEd.dll!UCookOnTheFlyServer::LoadPackageForCooking() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\UnrealEd\Private\CookOnTheFlyServer.cpp:3103]
0x00007ffb445d60d1 UE4Editor-UnrealEd.dll!UCookOnTheFlyServer::TickCookOnTheSide() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\UnrealEd\Private\CookOnTheFlyServer.cpp:2733]
0x00007ffb444415eb UE4Editor-UnrealEd.dll!UCookCommandlet::CookByTheBook() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\UnrealEd\Private\Commandlets\CookCommandlet.cpp:921]
0x00007ffb4446c75b UE4Editor-UnrealEd.dll!UCookCommandlet::Main() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Editor\UnrealEd\Private\Commandlets\CookCommandlet.cpp:595]
0x00007ff695f135ba UE4Editor-Cmd.exe!FEngineLoop::PreInitPostStartupScreen() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:3391]
0x00007ff695f0b75d UE4Editor-Cmd.exe!GuardedMain() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\Launch\Private\Launch.cpp:127]
0x00007ff695f0baba UE4Editor-Cmd.exe!GuardedMainWrapper() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:137]
0x00007ff695f1e28d UE4Editor-Cmd.exe!WinMain() [E:\UE4EngineBuilds\UE4dqsmod\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:268]
0x00007ff695f2036e UE4Editor-Cmd.exe!__scrt_common_main_seh() [D:\agent\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
0x00007ffb8aac7034 KERNEL32.DLL!UnknownFunction []
0x00007ffb8ac9cec1 ntdll.dll!UnknownFunction []

```

I tried adding breakpoints before building, but they are not catched...

How do you debug these kind of errors?

# Answer
> 0 votes
Found the BP by starting the project from VS DebugGame Editor mode.

In the stuff that the debugger catches (Autos) I was able to find the exact name of the BP.

---
Tags: unreal-4, debugging, build-process
---