Hi,
I am making a simple prototype of 2D game platform.
But I really don’t know what I am doing wrong to make the collectible item work.
I’ve tried the most variations and combinations of setups that I can imagine on the Unity, but without success.
1 - Player → Tag “Player” → Rigidbody2D (Dynamic), Box Collider 2D (checked and unchecked “Is Trigger”).
2 - Collectible item → Tag “Mushroom” → Rigidbody2D (Dynamic/Kinematic/Static), Box Collider 2D (checked and unchecked “Is Trigger”).
C# → Method (OnTriggerEnter2D): Script only applied to the collectible item “Mushroom”
void OnTriggerEnter2D (Collider2D other)
{
if (other.gameObject.CompareTag ("Mushroom"))
{
Debug.Log ("Found something: " + other.name);
other.gameObject.SetActive (false);
}
}
Debug doesn’t show anything and the active/deactivate doesn’t work.
I found some links here in the forum and tried to apply the solutions, but without success too.
I would like to know if there is some issue/bug with the version of the Unity (5.5) or if I am doing something wrong.
Thanks in advance.