Hello im getting this error
An object reference is required to access non-static member `UnityEngine.Animation.Play()'
there is my code
public class BottleControl : MonoBehaviour {
Rigidbody rb;
bool touched = false;
Vector3 curPos;
// Use this for initialization
void Start () {
rb = GetComponent();
}
// Update is called once per frame
void Update () {
if (Input.touchCount > 1 && touched == false)
touched = true;
else
touched = false;
if (touched || Input.GetMouseButtonDown(0)) {
curPos = transform.position;
if (curPos.y < 5f) {
rb.AddForce (new Vector3 (0, 1000, 0));
Animation.Play ();
//rb.AddTorque (new Vector3 (400, 0, 0));
}
}
}
}
↧