赞
踩
- FACTION_DATA CurActionData;
- UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "播放完成回调类(不要A,U前缀如Actor非AActor)")
- FString ClassName;
- UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "播放完成回调函数")
- FName CallBackUFunction;
-
- if (!ClassName.IsEmpty())
- {
- UObject* ClassPackage = ANY_PACKAGE;
-
- UClass* Result = FindObject<UClass>(ClassPackage, *ClassName);
- //动画结束回调
- if (Result && (!CallBackUFunction.IsNone()))
- {
- UFunction*CallBack = Result->FindFunctionByName(CallBackUFunction);
- if (CallBack)
- {
- ProcessEvent(CallBack, NULL);
- }
- }
- }
备注:回调类(不要A,U前缀如Actor非AActor),CallBackUFunction为Class中的UFUNCTION()函数
如类
- UCLASS()
- class TEST_API AZombieMonster :public:APawn
- {
- GENERATED_BODY()
- public:
- UFUNCTION()
- void OnAnimEnd();
- }
传入值 ClassName=FString("ZombieMonster"),不带前缀A AZombieMonster
传入值 CallBackUFunction=FName("OnAnimEnd");
最终会调用AZombieMonster::OnAnimEnd()函数
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。