Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » HELP » Help (General) » Youtube tutorial didn't work for me...Animation won't work

Youtube tutorial didn't work for me...Animation won't work

View previous topic View next topic Go down  Message [Page 1 of 1]

chellebell1689


Member [Lv. 0]
Member [Lv. 0]


Hello, I followed a youtube video and wrote the code exactly as he did, but mine gets four errors, while his doesn't. I don't know if it's because we're using different versions of unity (Me: Unity 5, him: whatever one was around in 2011) or what happened. Here's the full code:

using UnityEngine; using System.Collections;

public class Chest : MonoBehaviour { public State state;

public enum State
{
open,
close,
inbetween
}

void Start()
{
State = Chest.State.close;
}

void Update()
{

}

public void OnMouseEnter ()
{
Debug.Log ("Enter");
}

public void OnMouseExit ()
{

}

public void OnMouseUp ()
{
if (State == Chest.State.close)
Open ();
else
Close ();
}

private void Open()
{
Animation.Play ("OpenAnime");
State = Chest.State.open;
}

private void Close()
{

}


}

First two errors say "The left-hand side of an assignment must be a variable, a property, or an indexer." This is referencing lines 17 & 46.

Third error says "Expression denotes a 'Type', where a 'variable', 'value' or 'method group' was expected." This one is referencing line 37.

The last error says " An object reference is required to access non-static member `UnityEngine.Animation.Play()'", and is referencing line 45.


I came to this site because no one is answering any questions on the Unity Answer forums and the moderator(s) are taking 2 hours to approve a question. This project is due in about an hr & half. I've been working on this for weeks.

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum