Instantiate Behavior Tree

NodeCanvas Forums Support Instantiate Behavior Tree

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #11872
    zedz
    Participant

    Hi Forum,

    I have a question about instantiating BehaviourTree. The BehaviourTree was created in my resources folder, and I wish to start it in one of my custom action. I load the BehaviourTree like this:

    But then when I start it:

    The console shows:
    Graph: You have tried to start a graph which is an asset, not an instance! You should Instantiate the graph first.

    My question is, how could I bind(or assign, whichever term we use) the BehaviourTree asset onto an empty gameobject using script? Is there something like: gameobject.addcomponent<BehaviourTree>().AssignAsset(behaviourTreeAsset)?

    #11881
    Gavalakis
    Keymaster

    Hello there,

    As the log states, the BehaviourTree asset, needs to be instantiated before usage.
    So what you can basically do is this:

    While the above will work, if you want to bind the asset to a gameobject more permanently, you can do something like this:

    Let me know if the above work for you 🙂
    Thanks.

    Join us on Discord: https://discord.gg/97q2Rjh

    #11973
    zedz
    Participant

    Thank you very much! It works very well XD

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