25-08-2016, 10:50 PM
ciao e grazie per la risposta ed il tuo tempo ma non va..
e nel mio caso i due script (Player.cs e FirstPersonControler.cs) sono entrambi attaccati allo stesso gameobject
ho fatto come hai detto tu..ossia
nello script FirstPersonController ho impostato
public bool m_onLadder = false; (anche se lo avevo già fatto)
poi nello script Player.cs ho inserito ..in alto....oppure va inserita da un altra parte?
this.gameObject.GetComponent<FirstPersonController>().m_onLadder;
ma il compilatore mi da questi errori..
Assets/MyScripts/Player.cs(96,56): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration
Assets/MyScripts/Player.cs(96,70): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
Severity Code Description Project File Line Suppression State
Error CS0103 The name 'GetComponent<FirstPersonController>' does not exist in the current context. L.O.S.T. Pre Alpha v0.1.CSharp C:\Users\Peppe\Documents\L.O.S.T. Pre Alpha v0.1\Assets\MyScripts\Player.cs 96 Active
Severity Code Description Project File Line Suppression State
Error CS0103 The name 'm_onLadder' does not exist in the current context. L.O.S.T. Pre Alpha v0.1.CSharp C:\Users\Peppe\Documents\L.O.S.T. Pre Alpha v0.1\Assets\MyScripts\Player.cs 96 Active
Severity Code Description Project File Line Suppression State
Error CS0103 The name 'gameObject' does not exist in the current context. L.O.S.T. Pre Alpha v0.1.CSharp C:\Users\Peppe\Documents\L.O.S.T. Pre Alpha v0.1\Assets\MyScripts\Player.cs 96 Active
e nel mio caso i due script (Player.cs e FirstPersonControler.cs) sono entrambi attaccati allo stesso gameobject
ho fatto come hai detto tu..ossia
nello script FirstPersonController ho impostato
public bool m_onLadder = false; (anche se lo avevo già fatto)
poi nello script Player.cs ho inserito ..in alto....oppure va inserita da un altra parte?
this.gameObject.GetComponent<FirstPersonController>().m_onLadder;
ma il compilatore mi da questi errori..
Assets/MyScripts/Player.cs(96,56): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration
Assets/MyScripts/Player.cs(96,70): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
Severity Code Description Project File Line Suppression State
Error CS0103 The name 'GetComponent<FirstPersonController>' does not exist in the current context. L.O.S.T. Pre Alpha v0.1.CSharp C:\Users\Peppe\Documents\L.O.S.T. Pre Alpha v0.1\Assets\MyScripts\Player.cs 96 Active
Severity Code Description Project File Line Suppression State
Error CS0103 The name 'm_onLadder' does not exist in the current context. L.O.S.T. Pre Alpha v0.1.CSharp C:\Users\Peppe\Documents\L.O.S.T. Pre Alpha v0.1\Assets\MyScripts\Player.cs 96 Active
Severity Code Description Project File Line Suppression State
Error CS0103 The name 'gameObject' does not exist in the current context. L.O.S.T. Pre Alpha v0.1.CSharp C:\Users\Peppe\Documents\L.O.S.T. Pre Alpha v0.1\Assets\MyScripts\Player.cs 96 Active