DialogueNode Positioning

This is just a hint for anyone wanting a more elegant way of dealing with positioning of the nodes in the Dialogue editor. (At least it hasn’t been mentioned yet in the course)

Instead of using the Event.current.mousePosition and applying an offset based on a constant value, simply use the mouse delta (Event.current.delta) and add that onto the current position.

You will be able to move the node dragging any part of it while maintaining the mouse position in that node during the drag.
The size of the node will no longer matter this way allowing it to be expanded upon without the offsetting hassle.

                var delta = Event.current.delta;
                var rect = draggingNode.Rect;
                rect.position +=  delta;
                draggingNode.Rect = rect;
1 Like

A good tip, thank you!

Privacy & Terms