您当前的位置: 首页 > 

开发游戏的老王

暂无认证

  • 3浏览

    0关注

    803博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

虚幻引擎图文笔记:Gameplay框架(四)UActorComponent 类

开发游戏的老王 发布时间:2020-06-06 16:41:49 ,浏览量:3

  • UActorComponent派生自UObject
  • 它是所有“组件”的基类。
  • 只有AActor以及其派生类才能有“组件”。
声明
UCLASS(DefaultToInstanced, BlueprintType, abstract, meta=(ShortTooltip="An ActorComponent is a reusable component that can be added to any actor."), config=Engine)
class ENGINE_API UActorComponent : public UObject, public IInterface_AssetUserData
{
	GENERATED_BODY()
	...
}
生命周期

virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction);

virtual void BeginPlay();
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason);

virtual void OnRegister();
virtual void OnUnregister();

关于Tick

virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction);

UFUNCTION(BlueprintCallable, Category="Utilities")
virtual void SetComponentTickEnabled(bool bEnabled);

UFUNCTION(BlueprintCallable, Category="Utilities")
virtual bool IsComponentTickEnabled() const;

关于Tag
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Tags)
TArray ComponentTags;

UFUNCTION(BlueprintCallable, Category="Components")
bool ComponentHasTag(FName Tag) const;



关于Activate
UFUNCTION(BlueprintCallable, Category="Components|Activation", meta=(UnsafeDuringActorConstruction="true"))
virtual void Activate(bool bReset=false);

UFUNCTION(BlueprintCallable, Category="Components|Activation", meta=(UnsafeDuringActorConstruction="true"))
virtual void Deactivate();

UFUNCTION(BlueprintCallable, Category="Components|Activation", meta=(UnsafeDuringActorConstruction="true"))
virtual void SetActive(bool bNewActive, bool bReset=false);

UFUNCTION(BlueprintCallable, Category="Components|Activation", meta=(UnsafeDuringActorConstruction="true"))
bool IsActive() const { return bIsActive; }
关注
打赏
1656935939
查看更多评论
立即登录/注册

微信扫码登录

0.0404s