I got abnormal code which is compiled but crashes Unity editor when it runs.
public class SpawnEvent : IEvent
{
public enum Type
{
Avatar,
Player, // other player character
NPC,
Monster,
}
public GameObject spawnnedObject;
public Type type;
public override object GetData()
{
return spawnnedObject;
}
public override string GetName()
{
return this.GetType().ToString();
}
}
When it was initialized anywhere in other code side like that:
SpawnEvent spawnEvent = new SpawnEvent();
Unity editor is crashed. But when I modified the above class like that: (I modified Type enum to SpawnType)
public class SpawnEvent : IEvent
{
public enum SpawnType
{
Avatar,
Player, // other player character
NPC,
Monster,
}
public GameObject spawnnedObject;
public SpawnType spawnType;
public override object GetData()
{
return spawnnedObject;
}
public override string GetName()
{
return this.GetType().ToString();
}
}
It runs ok.
Any ideas?