Closed Bl4ck-orig closed 2 years ago
Hi Bl4ck-orig,
It seems you didn't mark the scriptable object as dirty after you cleared the data.
Can you try to add EditorUtility.SetDirty(test);
after the line test.ClearData();
?
The final result should be somehow like this:
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CreateAssetMenu(fileName = "ParalSyncEditorBug", menuName = "ParalSyncEditorBug")]
public class ParalSyncEditorBug : ScriptableObject
{
[SerializeField] private List<int> testVariable;
public void ClearData() => testVariable = null;
}
[CustomEditor(typeof(ParalSyncEditorBug))]
public class ParalSyncEditorBugEditor : Editor
{
public override void OnInspectorGUI()
{
ParalSyncEditorBug test = (ParalSyncEditorBug)target;
DrawDefaultInspector();
if (GUILayout.Button("Clear Data")) {
test.ClearData();
EditorUtility.SetDirty(test);
}
}
}
Hello.
Did not know about this function! My bad.
Thank you!
Cheers.
Describe the bug When an asset created by a class deriving from ScriptableObject is changed by a custom editor, the changes are not synced.
To Reproduce Steps to reproduce the behavior:
Expected behavior The asset is synced in both projects.
Screenshots/Video
Enviroment (please complete the following information):
Additional context ParalSyncEditorBug.cs: