- Home /
scripting question
I have this 3 script : script A , B and C. the script main concept : first thing is I load script A then a variable from script B is changed ( this works).
Then I load a function X in script C using script A. the function in script C changes the variable data in script B. All compile is fine...
but when I run the program and do the script, it goes hang.... wonder that if unity can't handle that?or is it an iOS limitation?
Here's some scripts from script A
function AccessScriptB() { if( touchWithinRange && scriptB.heroTrue == false) { scriptB.heroTrue = true; scriptB.heroImage = heroImage1; scriptC.X(); } }
Script C function is
function X() { scriptB.hNU = hN;}
the function X only has that line of command since I want to change it from script C for future update preparation
touchWithinRange is a range Selection Box
hNU is a static var in Script B
heroTrue is static var in ScriptB
hN is a static var in Script C
while in script B I only shows the variables in OnGUI function
GUI.Label ( myRectValues, hNU, mySkin.customStyles[1] ) ; } that's all I want to do, changing a variable in script B accessing from script A which calls the function in script C and displays it. Anyone can help me?function OnGUI() {
Post 3 scripts of no more than 5 lines each and someone here will be able to help. With luck, cutting them down will help you see your bug.
No, there is not a 3-script limitation in iOS.
Answer by synapsemassage · Jul 02, 2011 at 11:37 AM
There are different ways to access functions inside other scripts. Search for "getcomponent" or "sendmessage" or "broadcastmessage" in the docs, in the forum or here. You will find plenty of answers.