Question by
unity_IVk9EogzXtmDmQ · Jan 08, 2018 at 06:28 PM ·
triggerontriggerenterif
Trigger activates multiple events
Hello Guys, I have a Little Problem with a Scene, where I have two VEhicles that the Player can enter. Each Vehicle has a Trigger and a script that uses the Trigger of the Vehicle and activates the Camera of the Vehicle. The Problem is: When I enter the trigger of the first vehicle, the camera of the second vehicle gets activated too. My Script:
void OnTriggerEnter(Collider other)
{
if (other.transform.name == "Trigger1")
{
inTrigger_p = true;
character = other.gameObject;
}
}
Other Things I tried:
if (other.name == "Trigger1") if (other.transform.tag == "Trigger1") if (other.tag == "Trigger1") if (other.CompareTag("Trigger1"))
The trigger´s name is Trigger1 and its tag is also Trigger1.
Has anyone an Idea what my mistake could be?
Comment