NodeCanvas Forums › General Discussion › [Request] Better editor scripting support › Reply To: [Request] Better editor scripting support
Works great, thanks Gavalakis, any chance this comes bundled in the next version (I dont want to remember adding it everytime I upgrade)
BTW, I was able to make OnSceneGUI Work by adding these changes, dont know if this is the best way to do that with the graph structure, let me know if you think it’s fine and if you can add it
GraphOwner class
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
protected void Start() { if ( firstActivation == FirstActivation.OnStart ) { if ( !isRunning && enableAction == EnableAction.EnableBehaviour ) { StartBehaviour(); } } InvokeStartEvent(); startCalled = true; // Not sure if this is the right place to do this, but it works for now #if UNITY_EDITOR SceneView.duringSceneGui += OnSceneGUISelected; #endif } protected void OnDestroy() { if ( ParadoxNotion.Services.Threader.applicationIsPlaying ) { StopBehaviour(); } foreach ( var instanceGraph in instances.Values ) { foreach ( var subGraph in instanceGraph.GetAllInstancedNestedGraphs() ) { Destroy(subGraph); } Destroy(instanceGraph); } #if UNITY_EDITOR SceneView.duringSceneGui -= OnSceneGUISelected; #endif } ///<summary>Forward Scene GUI callback</summary> void OnSceneGUISelected(SceneView view) { if ( Editor.GraphEditorUtility.activeElement != null ) { var rootElement = Editor.GraphEditorUtility.activeElement.graph.GetFlatMetaGraph().FindReferenceElement(Editor.GraphEditorUtility.activeElement); if ( rootElement != null ) { foreach ( var task in rootElement.GetAllChildrenReferencesOfType<Task>() ) { task.OnSceneGUISelected(); } } } } |
Task class
1 2 3 |
virtual public void OnSceneGUISelected() { } |