This function is not detecting the collision C#
My collision code is as follows:
void OnTriggerEnter2D (Collider2D coll)
{
Debug.Log("Collision Detected");
if (coll.gameObject.tag == "Goal")
{
scenechange();
}
}
My debug log never plays which tells me it is not detecting the collision, attached is my inspector for my Projectile and my goal objects which seem to have all the components I need.
All help is appreciated.
Answer by tormentoarmagedoom · May 09, 2018 at 06:38 PM
Good day.
I don't see any script in the goal object., so this code is not inside it.
If you are using OnTriggerEnter, it must be in a script inside the object that contains the trigger collider.
If helped, accept the answer
Bye :D
Your answer
Follow this Question
Related Questions
C# access a generic list from another controller -1 Answers
OnTriggerEnter/Exit Rapid Firing? 0 Answers
1 Restart Scene multiple levels. Is this possible? - C# - 1 Answer
Using Multiple Activated Triggers to trigger a Separate Event. 0 Answers
(SOLVED) Need help with Script that is supposed to get components of an AI and change them 1 Answer