Announcement

Collapse
No announcement yet.

Behavior Tree usage in 4.3

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Behavior Tree usage in 4.3

    Hey Guys

    I've been playing around with 4.3 and would like to know how we should use Behavior Trees now in 4.3. The previous version's code was like this

    Code:
    static ConstructorHelpers::FObjectFinder<UBehaviorTree> BehaviorTreeBP(TEXT("BehaviorTree'/Game/Blueprints/Behavior/MyAIBehaviorTree.MyAIBehaviorTree'"));
    	if (BehaviorTreeBP.Succeeded())
    	{
    		MyAIBehaviorTree = BehaviorTreeBP.Object;
    	}
    Code:
    UPROPERTY(VisibleAnywhere, Category = Behavior)
    		TSubobjectPtr<class UBlackboardComponent> BlackboardComp;
    
    	UPROPERTY(VisibleAnywhere, Category = Behavior)
    		TSubobjectPtr<class UBehaviorTreeComponent> BehaviorComp;
    Code:
    BlackboardComp = PCIP.CreateDefaultSubobject<UBlackboardComponent>(this, TEXT("BlackBoardComp"));
    	BehaviorComp = PCIP.CreateDefaultSubobject<UBehaviorTreeComponent>(this, TEXT("BehaviorComp"));
    However, now it all generates errors as if an #include < ... > in not included. Any ideas ??

    #2
    You need to include BehaviorTree headers now.

    #include "BehaviorTree/BlackboardComponent.h"
    #include "BehaviorTree/BehaviorTreeComponent.h"
    #include "BehaviorTree/BehaviorTree.h"

    Also AIController.h is no longer in GameFramework so if you're using an AAIController;

    #include "AIController.h"

    is all you need
    @kylerocha
    Luminawesome Games
    http://luminawesome.com/

    Comment


      #3
      Ahh great thanks, i'll try it out.

      Comment


        #4
        Awesome. it worked, thanks !

        Comment

        Working...
        X