SerializableProperty for a gameObject inside an array of a custom class inside of a ScriptableObject not setting.
I have a SerializableProperty for a gameObject inside an array of a custom class inside of a ScriptableObject and its not saving not setting.
[System.Serializable]
public class DataModel : ScriptableObject
{
public int uuid = -1;
public string modelName;
public string modelDescription;
public DataField[] modelFields;
}
[System.Serializable]
public class DataField
{
public enum FieldType
{
String,
Int,
Float,
Date,
Key,
Boolean,
Byte,
}
public string fieldName;
public FieldType fieldType;
public GameObject variable;
}
everything on the SerializedProperty saves as intended except for GameObject variable inside the DataField. it shows up in the inspector it just doesn't let me it and save for the matter.
EditorGUILayout.PropertyField(spFieldVariable, GUIContent.none, GUILayout.ExpandWidth(true));
been at this for a while now, and can't figure it out. using EditorGUILayout.ObjectField I can get it to set but since I'm setting directing on variable and not SerializedProperty it doesn't save.
this.dataModel.model.modelFields[i].variable = (GameObject)EditorGUILayout.ObjectField(spFieldVariable.objectReferenceValue, typeof(GameObject), true, GUILayout.ExpandWidth(true));
Your answer
Follow this Question
Related Questions
Unity3D ScriptableObject with UnityEvent not saving event parameter 0 Answers
How can I load an custom file from the Assets folder? 1 Answer
SerializedObject asset loses data when pressing play 1 Answer
Serialization Placeholder Value for Different Fields? 1 Answer
How to break reference from .asset classes and runtime copied values? 2 Answers