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 #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); }}

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:

  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)}   

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:

  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'   

You can type doRotate to var script Is set example, this var doRotate example, with it you can access var "doRotation" and change its value.

Something like this:

  var script: doRotate = doRotation.GetComponent (doRotate); If (script) script.doRotation = true;    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -