#OnOpenAsset
1 messages · Page 1 of 1 (latest)
You didn't fully read the example code, or at least understand it.
OnOpenAsset goes on static methods. It does not matter what class they are in.
Why would you do anything in InitializeOnLoad?
I was looking at that thread
https://forum.unity.com/threads/is-it-possible-to-open-scriptableobjects-in-custom-editor-cindows-with-double-click.992796/
last post
As the example code shows, you would get the object that is being opened with
var targetObject = EditorUtility.InstanceIDToObject(instanceID);
Then check the type
bool isMyType = targetObject.GetType() == typeof(MyType);
ah so that function is called when any asset is opened?
Yes