Closed Nerglej closed 3 years ago
You can use an IMGUIContainer to render IMGUI stuff inside UIElements: https://docs.unity3d.com/ScriptReference/UIElements.IMGUIContainer.html
But I'm not sure if it's possible to manually draw the UnityEvent field.
I guess the best option here would be to use the built-in unity drawer with a PropertyField but it requires consequent changes. That would also fix #160 btw.
Okay, I managed to finish the implementation of SerializedProperties in the node views so now all the builtin Unity property drawers are supported including the UnityEvent one :)
using UnityEngine;
using GraphProcessor;
using UnityEngine.Events;
[System.Serializable, NodeMenuItem("Custom/Unity Event Node")]
public class UnityEventNode : BaseNode
{
[Input(name = "In")]
public float input;
[Output(name = "Out")]
public float output;
public UnityEvent evt;
public override string name => "Unity Event Node";
}
I've gone through loads of Unity forums, trying to implement it myself, but NodeGraphProcessor is UIElements based, and Unity currently only supports UnityEvents in the inspector, with IMGUI.
Right now I'm stuck implementing it.
So I'm asking for help, implementing a FieldDrawer for UnityEvents.