六一的部落格


关关难过关关过,前路漫漫亦灿灿。



ActorComponent


UActorComponent


UActorComponent::GetOwner

访问组件上级

1// Follow the Outer chain to get the  AActor  that 'Owns' this component
2UFUNCTION(BlueprintCallable, Category="Components", meta=(Keywords = "Actor Owning Parent"))
3AActor* GetOwner() const;

UActorComponent::GetOwner<T>

访问组件上级

1// Templated version of GetOwner(), will return nullptr if cast fails
2template< class T >
3T* GetOwner() const
4{
5    return Cast<T>(GetOwner());
6}

自定义组件


ActorComponent


UActorComponent


UActorComponent::GetOwner

访问组件上级

1// Follow the Outer chain to get the  AActor  that 'Owns' this component
2UFUNCTION(BlueprintCallable, Category="Components", meta=(Keywords = "Actor Owning Parent"))
3AActor* GetOwner() const;

UActorComponent::GetOwner<T>

访问组件上级

1// Templated version of GetOwner(), will return nullptr if cast fails
2template< class T >
3T* GetOwner() const
4{
5    return Cast<T>(GetOwner());
6}