Hello, I’m working on my own Quest System plugin (at the moment I have two modules in it: Runtime and Editor) for Unreal Engine 4.
I can’t understand the difference between the interfaces of two nodes that Unreal Engine has, I mean UEdGraphNode and UK2Node (which inherits the first one).
I’ve been exploring:) the UE source code and found out a few things:
Behavior Tree and Niagara use the UEdGraphNode interface to implement their functions and logic (schema class - UEdGraphSchema).
Animation Graph uses UK2Node interface (schema class is UEdGraphSchema_K2) to implement it’s logic and functionality.
But I can’t understand 1) Why they use different interfaces? 2) Does using UK2Node mean I need to use the UEdGraphSchema_K2 class, or I can use base schema class to add new nodes to my editor, connect them and so on? 3) What does UncookedOnly (or Developer) type of module means and why UK2Node demands it ? 4) How to make BT-like nodes and implement logic inside them? 5) What the main difference between UK2 node and base node?
By interfaces of nodes and schemes, I simply mean classes whose functions we can override as we please. In the engine code they are called interfaces, so I also resorted to this name.
That’s my editor at the moment (without K2 interface)
Because they do different things. It’s nearly impossible to write one system that can do everything so you write enough to do a lot of the common things (UEdGraphNode) but then you write more specific ones for more specific use cases (Blueprint, Niagara, BT, etc).
You probably need to use that schema. If you want a custom schema, you can likely derive from it to make a one but the K2 node is probably expecting to get some information from the K2 schema.
There are 3 ways to run the game, from the Editor in PIE, without the Editor using the -game command line and without the Editor with cooked data. You don’t need the k2nodes in a cooked build, so it can’t be a Runtime module. You do need them when running the cooker or -game because those builds need to be able to compile loose blueprint files but those builds don’t load Editor modules. That leaves UncookedOnly.
No idea, but since you mentioned Behavior Trees don’t use the K2 interfaces you may not be able to replicate that behavior in the same way. However normal blueprint do have the ‘collapse nodes’ functionality that you could look at.
The EdGraphNode is mostly concerned with how it’s viewed, placed on a canvas, pin management, that kind of thing. The K2 node is concerned with compilation and turning the node graph into bytecode that can be run by the blueprint virtual machine.