I have this ScriptableObject class:
public class ExampleScriptableObject : ScriptableObject {
public string testName;
public int value;
}
which I instantiate with this code:
[MenuItem("Assets/Test/ExampleScriptableObject")]
public static void CreateExampleScriptableObject() {
ScriptableObjectUtility.CreateAsset<ExampleScriptableObject>();
}
and the access it from this MonoBehaviour:
class ExampleMonoBehaviour : MonoBehaviour {
public ExampleScriptableObject ExampleScriptableObject;
public string TestName;
public int Value;
private void OnValidate() {
ExampleScriptableObject.testName = TestName;
ExampleScriptableObject.value = Value;
}
}
Each time I change value in the inspector and save scene/project, the change is only reflected in the scene file;
but asset file remains empty:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1929e198d1f69204cbed8c2482e19fe9, type: 3}
m_Name: Test.ExampleScriptableObject
m_EditorClassIdentifier:
How can I save changes made to asset to disk instead of to the scene file?