- Home /
Public Sterialized Varibal Not Apearing In Inspector
As you see the varibals wont appear, I'v tried everything and i have looked at other similar questions but i can't fix the problem. Their are no errors I know of and this is the only script in my project.
Answer by Bunny83 · Jun 28, 2015 at 10:50 AM
Your MoveLocations class doesn't contain any variable at all, so there's nothing to show in the inspector. Keep in mind that a class is just a description of how an instance looks like. You actually want to add a public variable of type "PossibleMoveLocations" to your "MoveLocations" class. Since you used the plural you might want to use an array or List?
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class MoveLocations : MonoBehaviour
{
[System.Serializable]
public class PossibleMoveLocations
{
public int moveTime ;
public int moveId;
}
public List<PossibleMoveLocations> locations;
// or if you don't want a list / array:
public PossibleMoveLocations oneLocation;
}
But wouldn't
Public class $$anonymous$$oveLocations : $$anonymous$$onoBehaviour
{
[System.Serializable]
public class Possible$$anonymous$$oveLocations
{
public int moveTime ;
public int moveId;
}
}
Be the instance?
No, you are declaring the class if you write this, you just give the structure of your future instances. You are not declaring the actual instance belonging to the $$anonymous$$oveLocations class.
But shouldn't 'class' be like a 'int' where it puts the instant automaticly?