|
Hi, I have a script to control the movement of an elevator. On this script I have a private var that controls the speed - elevSpeed. I want to be able to control this variable using an Horizontal Slider defined on another script - therapistGUI. How can I do this? thanks,
(comments are locked)
|
|
I'll answer my own question because I was able to find the solution. I don't know if you prefer me to delete the question, but I think it can be useful for others. To access a variable from another script we need to define it as a global variable: static var elevSpeed then to access from another script we just need to call the scriptName.globalVarName: Elevator.elevSpeed On this case I used the variable to control the speed of the elevator with an horizontal slider: Elevator.elevSpeed = GUI.HorizontalSlider (Rect(25,185,100,25), Elevator.elevSpeed, 0.0, 10.0); hope it helps other like me If you find the solution, answering your own question is perfectly fine. I think the only thing that's frowned on is creating questions you already know the answer to just to get points.
Mar 19 '10 at 10:29 PM
Michael La Voie
LOOL do you really think I'm asking questions that I know the answers just to earn points? I ask questions because I have a work to finish..If I found the answer after asking I think its honest to say that I found it and to share with the other members of the forum..
Mar 20 '10 at 01:31 AM
maveryck21
reguardless of why the question was posted, it helped me understand this principle. Thanks mavery.
Apr 22 '10 at 09:36 AM
TinyUtopia
thanks! It was useful to me as well.
Jul 03 '10 at 06:40 PM
Edy
Helpful to me as well - thanks - AlexisMichail
Dec 04 '10 at 04:46 PM
schwertfisch
(comments are locked)
|
