Question by
Reid_Taylor · May 14, 2020 at 04:24 PM ·
editorscriptableobjectstaticnode
Making Node editor but having problem with passing through non static data to static method
Hi... Im creating a Node editor system and im trying to accomplish a shader graph like system where you create a scriptable object then double click on it to open editor. Everything is working so far except for I need to pass graph data from the scriptable object to editor window. But opening the editor window is static method and so I can't pass in (this) or (private Graph graph) it needs to be (static Graph graph) which won't work cause this variable needs to be specefic to the scriptable object. Heres the script
[CreateAssetMenu(fileName = "New Graph", menuName = "Graph", order = 52)]
public class Graph : ScriptableObject
{
public static Graph instance;
public List<Node> nodes = new List<Node>();
private void OnEnable()
{
instance = this;
Debug.Log(instance.GetInstanceID());
}
[OnOpenAsset]
public static bool OpenEditor(int instanceID, int line)
{
if (instanceID == instance.GetInstanceID())
{
WindowEditor.ShowWindow(instance);
}
return false;
}
}
Anyone have any ideas for somehow passing through specific Graph data? Thanks
Comment