- Home /
State machine - using Assets.Code.States; - error CS0246: The type or namespace name `Assets' could not be found.
Hi all, I'm following this book, and using the C# language. I'm on chapter7 where we make a state machine, I've typed all the necessary information it asks me to write. In the Assets folder I got a folder named 'Code', and in Code I got another 2 folders 'Scripts' and 'States'. In the 'Scripts' folder I got a script 'StateManager', and in the 'States' folder I got a script called 'BeginState'. Any response is appreicated.
The full error is - Assets/Code/Scripts/StateManager.cs(2,7): error CS0246: The type or namespace name `Assets' could not be found. Are you missing a using directive or an assembly reference? (StateManager)-
using UnityEngine;
using Assets.Code.States;
public class StateManager : MonoBehaviour
{
private BeginState activeState;
void Start ()
{
activeState = new BeginState();
Debug.Log("This object is of type: " + activeState);
}
void Update ()
{
}
}
(BeginState)-
using UnityEngine;
namespace Asses.Code.States
{
public class BeginState
{
public BeginState ()
{
Debug.Log("Constructing BeginState");
}
}
}
Answer by Kazhium · May 10, 2014 at 02:16 PM
I found the problem; on line 3 on 'BeginState' script, after namespace it's 'Assets', not 'Asses'.
Hope others benefits from this as well.