Hello all,
i am a newbie in this Unity awesomeness... i have this simple code to rotate a given game object:
function Update() { transform.Rotate(0, 20 * Time.deltaTime, 0); }
it works quite well, just the way i want it to happen. however i couldnt figure out how to connect GUIToggle button with this code. what i mean is, when i toggle the GUIToggle button on, the cube starts to rotate, when untoggle it stops...
is there ay way to do this with using the Gui Toggle button?
Yes, this code is C# and you are trying to use it as a JavaScript...
– IJMActually, it's probably because there's no 'using' directive and MonoBehaviour is unqualified.
– j_y_ksry. I didn't see rotate.cs; You need to add using UnityEngine; using System.Collections; on the top of this script, before public class rotate : MonoBehaviour
– IJMI mada an edito on my answer, copy this new code and it will work.
– IJMYes...you can do the same thing. Make a new boolean (bool) and place the new if stream inside the OnGUI function.
– IJM