Unity mystery:
1) In a new scene, create a cube. Give it scale 5,5,5, a transparent material, and make its BoxCollider a trigger.
2) Create a sphere inside the cube. Give it a RigidBody with no gravity.
3) Attach this script to the cube:
public class Hark : MonoBehaviour
{
private void OnCollisionStay(Collision other)
{
if (other.gameObject.name != "Ground")
{
Debug.Log(other.gameObject.name);
}
}
}
When run, shouldn't the cube detect the sphere inside it? Why doesn't it? How can I detect that?
#unity #unity3d #GameDev