Quantcast
Channel: Latest Questions by Grievemourne
Viewing all articles
Browse latest Browse all 51

How do I get a variable from another script and share the value of that variable between scripts?

$
0
0
I've been told to set variables to public, which I have - but I'm not sure if I've understood correctly that I have to have the scripts on the same game object? Is there no way to call out the variables from other scripts without having them on the same objects? I have some variables I want to have in the player script to have a better overview. The variables are: public var feetUp : boolean = false; public var feetDown : boolean = true; public var feetSouth : boolean = false; public var feetNorth : boolean = false; public var feetEast : boolean = false; public var feetWest : boolean = false; but I need to refer to them and change them in 6 other scripts with triggers. Can I call out the variables, and do I have to return a value for it to stay changed between the scripts? Not being a programmer and working with this for a while has made me a bit loopy, so I apologize in advance for any potential lack of sense.

Viewing all articles
Browse latest Browse all 51

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>