void Start() { if (offsetSO == null) { offsetSO = Resources.Load("TransformOffsetData/" + gameObject.name) as TransformOffsetScriptableObject; } }
public void CreateScriptableObject() { if (offsetSO == null && Resources.Load("Assets/Resources/TransformOffsetData/" + gameObject.name) == null) { offsetSO = ScriptableObject.CreateInstance <TransformOffsetScriptableObject>(); AssetDatabase.CreateAsset(offsetSO, "Assets/Resources/TransformOffsetData/" + gameObject.name + ".asset"); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); } }
public void OnDuplicate() { offsetSO = null; CreateScriptableObject(); }