I just began learning how to use Unity today with a course on Udemy. I did exactly as the person did (using Gui to make a cube move) when coding but I keep getting the same error. This is my first time and I am trying not to miss anything!
using UnityEngine;
using System.Collections;
public class ForceScript : MonoBehaviour {
public Rigidbody mycube;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI() {
if (GUI.Button(new Rect(10, 10, 150, 100), "Upward Force")){
mycube.AddForce (0,200F,0);
}
}
I'll be looking forward to a response. Thanks.
↧