variables - How to make GUI Button activate script (JS or C#) in Unity3d -
I really need help in making your GUI. Button launches a JS script (or C #) associated with a game object. Here's what I have in my application: "Public Vari doRotation = false" by the JS script "Dorotat.Jes", which rotates on Game Object I have a JS script that renders some GUI.buttons I press 2 button once, to call the "doRotate.js" script whose The meaning is reaching boolean "depression" and its opportunity for "true", as it is inspector I am trying to do this by now, but I get this error "Error BCEE 00020: An example of type 'dotat' to reach non-static member 'two quotations (BCEX 2020) Here is the code on GUI.button: What have I done wrong? I am trying for the day, how can I use this variable on GUI's click to work without success. button? Can anyone help me? This error occurs because you access a nonstatic member of "doRotate" with a class Are trying, not with an example of it. In this following code: You can type Something like this: #pragma in strict public var doRotation = false " True ", then the rotation begins; Function Updates () {if (doRotation) {transform.Rotate (new vector 3 (0, 50, 0) * Time.deltaTime); }}
var has the original_method: Float = 480; Var has the original_heat: float = 320; Var addImage: Texture2D; Var BTNT1: Texture; Var BTNectection 2: Texture; function ONGI () {var rx: float = Screen.width / native_width; var ry: float = Screen.height / native_height; GUI.mat rix = Matrix4x4.TRS (vector 3 (0, 0, 0), Quaterno, familiar, vector 3 (Rx, Ray, 1)); GUI.Box (Reit (20, 200, 429, 129), ed image , ""); If (! BTNETEct1) {debug.logger error ("Please give a texture on the inspector"); return;} GUI button (RIT (54, 222, 52, 35), BTNET Act 1); (! btnTtexture2) {debug.LogError ("Please give a texture on the inspector"); Return;} if (GUI button (RIT (118, 222, 52, 35), BTNTEXset 2); var Random: Game Object [ ] = GameObject.findgram object and tag ("m Rkr object "); (Var doRotation: GameScript in runScript) {var script: doRotate = doRotation.GetComponent (doRotate); If (script) doRotate.doRotation (); // Error BCE0020: An example of type 'doRotate' is required to access non-static member 'doRotation' (BCE0020)}
var script: doRotate = doRotation.GetComponent (doRotate); If (script) doRotate.doRotation (); // Error BCE0020: An example of the type of doRotais required to access non-static member 'doRotation'
doRotate to var
script Is set example, this var
doRotate example, with it you can access var "doRotation" and change its value.
var script: doRotate = doRotation.GetComponent (doRotate); If (script) script.doRotation = true;
Comments
Post a Comment