How to set a bool from a script equal to another bool from another script?
Hello, I have had a problem here that when i try to set a bool in a script "SortingOrderScript" equal to another bool which is available in another script "PlatformerCharacter2D" which is linked to a game object "Player" , it doesn't recognize the script as a component of that object. Also the script "SortingOrderScript" is linked to a child "Arm" of the game object "Player"
Answer by Paulo-Henrique025 · Oct 19, 2015 at 05:58 PM
SortingOrderScript is under the global namespace
PlatformerCharacter2D is under the UnityStandardAssets._2D namespace
To access the classes under a namespace you can add a using UnityStandardAssets._2D
to the beginning of the file or access the namespace directly from the implementation, example:
player.GetComponenet<UnityStandardAssets._2D.PlatformerCharacter2D>();
Your answer
Follow this Question
Related Questions
Activating Scripts in another Script? 2 Answers
Enabling & Disabling Script via On Click 1 Answer
Component as parameter 1 Answer
How can i create List of maps from each Map class ? 0 Answers
Saving Data (please help) 0 Answers