I declare a bunch of variable in my path class.
public static class p {
static public string gamepath= Path.GetDirectoryName(UnityEngine.Application.dataPath);
static public string localpath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), g.GameName);
readonly static public string Resourcesfull = p.Combinem(gamepath, "Assets", "Resources\\");
static public string gamesetpath = p.Combine(gamepath, "gameset\\");
There are many more variables that base on gamepath.
Today i suddenly got:
UnityException: get_dataPath is not allowed to be called during serialization, call it from Awake or Start instead. Called from MonoBehaviour 'execute' on game object 'script'.
I did get it sometimes before but the construction worked in general.
Now i have three questions:
Why does it sometimes work and sometimes not?
Why does unity3d insist on it not be called during serialization?
What can i do now in no case i want to rewrite that variables so i need the data path during serialization?