Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Changing variable on collision with player.

Discussion in 'Scripting' started by Orion_Reed, Jan 17, 2016.

  1. Orion_Reed

    Orion_Reed

    Joined:
    Aug 14, 2012
    Posts:
    39
    This should be a very simple question but my mind seems to have broken, here is what I have:

    Code (CSharp):
    1. void OnTriggerEnter (Collider collidedWith)
    2.     {
    3.         if (collidedWith.tag == "Player")
    4.         {
    5.             collidedWith.transform.GetComponent<PlayerController>().mainPlayerInput.Respawning = true;
    6.         }
    7.     }
     
  2. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,731
    Your mind seems to have broken to the point you forgot to ask the actual question! ;)
     
  3. Orion_Reed

    Orion_Reed

    Joined:
    Aug 14, 2012
    Posts:
    39
    Quite possibly ;) I solved it anyway, the variable was being overriden on Update() from another script. :)