Hi I’ve created a second C# script to handle triggering of another line for delivering the package.
I’ve done it exactly the same as in the example:
public class Customer: MonoBehaviour
void OnTriggerEnter2D(Collider2D other)
{
if(other.tag == “Customer”)
{
Debug.Log(“Package delivered.”);
}
}
It didn’t write anything in the console.
But when I’ve added it to the entire code from the lesson everything was working fine
public class Delivery : MonoBehaviour
{
void OnCollisionEnter2D(Collision2D other)
{
Debug.Log(“Hey I’m printed”);
}
void OnTriggerEnter2D(Collider2D other)
{
if(other.tag == “Package”)
{
Debug.Log(“Package picked up.”);
}
if(other.tag == “Customer”)
{
Debug.Log(“Package delivered.”); }
}
I’m confused right now O.o
This refers to Lesson IF statement from Unity 2D Delivery Driver Project.