|
Hi everyone I want to make a GUI button which instantiates a prefab which uses the distance between the player and the prefab itself to modify variables. But when I try to assign the variable othertransform, the transform of the player, the inspector doesn't recognize it. So, how do I assign the variable othertransform from within a script. My player is just the original 3rd Person Controller and it has a tag called Player. These are my scripts: This is the object I want to instantiate And this is the script I use to generate my button and to instantiate the prefab: Please help me solve this problem.
(comments are locked)
|
|
Fine! Please don't tell me how. I could need it x__x
(comments are locked)
|
|
I just instantiated a trigger. When the player enters the trigger the variable is changed. I still don't know why I wanted to use Vector3.distance. It works terrible for me, triggers are way better to use.
(comments are locked)
|

Perhaps try:
othertransform = GameObject.Find("3rd Person Controller");
Your solution didn't work, but I solved it already.