|
Hey I am havin a small problem, I have a script called CharacterScript in that script I am defining a PlayerState which works fine. No I wanted to create a new Object which needs the information if the Player is in PlayerState 1 or 2. May script so far is: var StateScript: CharacterScript; function OnTriggerEnter (collisionInfo : Collider){ StateScript = GetComponent(CharacterScript); if (collisionInfo.gameObject.tag == "player" && StateScript.PlayerState == 1){ } } Somehow it does not work, seems like the object is not recieving the PlayerState... What did I do wrong ?
(comments are locked)
|
|
Either there is no Character script on the same object as this script is on, or the tag is not "player". I would set a breakpoint in the debugger to check for it, or you can use Debug.Log to print out variables if you don't like the debugger. It might help if you post the CharacterScript code. How is PlayerState declared there?
(comments are locked)
|
