I’m trying to set this variable, my montage “AM_MakeWay”
But I can’t find any method to set.
UPROPERTY(VisibleAnywhere, Category = “Default”)
UAnimMontage* SkillMontage;
I’m trying to set this variable, my montage “AM_MakeWay”
But I can’t find any method to set.
UPROPERTY(VisibleAnywhere, Category = “Default”)
UAnimMontage* SkillMontage;
I suppose that you want to define which Anim Montage should be used in c++ and you want to define it from within your object or blueprint.
For this you don’t need a reference variable to a montage but a TSubclassOf variable.
Have a look at this:
I realize that using TSubclassOf is better than that.
But anyway, is it impossible to set SkillMontage var’s default value to “AM_MakeWay” in C++ code?
Should it must be create as child blueprint and set by designer?
this is what I did
SkillMontage = TEXT(“AM_MakeWay”);
Perhaps this might be possible but it is really a bad idea.
I think that referencing blueprint classes in c++ is a bad idea because you reference in two directions. Furthermore you could delete a blueprint and break your c++ code.
C++ should always be stable.
I will keep in mind. Thank’s a lot!
TObjectPtr<class UAnimMontage> Montage = ConstructorHelpers::FObjectFinder<class UAnimMontage>(TEXT("/Game/Animations/AM_MyMontage")).Object;
must be called in constructor.