how to load BT?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #14871
    facebookuser
    Participant

      i am practicing instantiating BT by sample sceane Demo1.
      i made prefab CommmonBehaviourTree, CommonBlackboard in resource folder.
      but loaded is null.
      what’s wrong?

      here is the code.

      void Start () {
      GameObject clone = Instantiate(Resources.Load(“Soldier”)) as GameObject;
      BehaviourTree bt = Instantiate(Resources.Load(“CommonBehaviourTree”)) as BehaviourTree;
      Blackboard bb = Instantiate(Resources.Load(“CommonBlackboard”)) as Blackboard;

      clone.AddComponent<BehaviourTreeOwner>();
      clone.GetComponent<BehaviourTreeOwner>().blackboard = bb;
      clone.GetComponent<BehaviourTreeOwner>().StartBehaviour(bt);
      }

      #14872
      Gavalakis
      Keymaster

        Hello,

        Can you please clarify what is null?
        Are you certain that the naming is correct and is matching the name of the prefab into the resources folder?
        Thanks

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