|
Hello, I wish to use a value in say B script. Now in A script I have a variable is modified using GUI in run time. I wish to use that same variable in another script in run time i.e. changes in GUI should affect both the variables. Code : Could someone help me with this? Thank you very much in advance.
(comments are locked)
|
|
If the above script is defined in a file named CannonController.js, you could refer to it in another script like this: filename: SomeOtherScript.js
When you define a public variable named cannonScript of type CannonController you can assign any object with a CannonController script attached to it in the Inspector. You can do that like this:
I'm not sure why you have those static variables. Perhaps you could explain that. It worked out pretty well. My perception was as I use a static variable I though I could alter or use it in another script too. But this method never stuck me. To elaborate I never knew that you create a variable of the type of another script. Thank you very much.
Dec 03 '11 at 10:50 PM
Karsnen
And a small correction. The first line of your script. I think you tried to mention the name of the script. If so it is not "CameraController", it is "CannonController". Just for someone who might be looking into this answer for their own purpose in future.
Dec 03 '11 at 10:56 PM
Karsnen
(comments are locked)
|
