Hi,
firstofall sorry if someone already asked it. Can’t find it myself. Hope you don’t mind.
So. I made a class ,here is what it looks like.
[System.Serializable]
public class NoMonoBehaviour
{
[SerializeField] private MyScriptableObject _scriptableObject;
}
As you can see it has been serialized, and has scriptable object as serialized field.
Yet I have another class with monobehaviour.
public class MonoBehaviourClass: MonoBehaviour
{
[SerializeField] private NoMonoBehaviour _classWithFieldOfScriptableObjects;
}
I add MonoBehaviourClass to the prefab. Put prefab in resources folder.
Now in Inspector I can expand the ClassWithFieldOfScriptableObjects and it shows the _scriptableObject field.
I create new asset of MyScriptableObject type, wich naturally derives from ScriptableObject class.
And set the created MyScriptableObject to _scriptableObject field.
Unfortunately when I make PhotnNetwork.Instantiate(prefab); it creates prefab.name(clone) but the _scriptableObject field is empty.
Thanks if someone can tell me how to make this work, or at least why it is not working as I wanted to.