How to Auto Position/Align/Layout Tree Nodes?

Forums 💬 NodeCanvas ⚙️ Support How to Auto Position/Align/Layout Tree Nodes?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #23049
    shenciao
    Participant

      Hi developer,

      I create a behavior tree at runtime and want to view it with the graph editor, but all the newly created nodes are positioned in the same place.

      Is there a button or function that can automatically position all nodes in the tree to make it visually appealing in one click or function call?

      #23050
      Gavalakis
      Keymaster

        Hello there,

        There is no option to auto-arrange the nodes, but since you create the nodes in runtime from code, you can set the position of each node when you create it. The “graph.AddNode” method has an overload that accepts Vector2 parameter for the position of the node (you can also just set it afterwards with the “node.position” property of course.

        Let me know if that works for you.

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.