[UE4]Component相关常用API

来源:互联网 发布:古典网站源码 编辑:程序博客网 时间:2024/06/06 17:39

http://www.dawnarc.com/2017/02/ue4component%E7%9B%B8%E5%85%B3%E5%B8%B8%E7%94%A8api/

Actor.h

//获取第一个与指定类型相同的ComponentUActorComponent* AActor::FindComponentByClass(const TSubclassOf<UActorComponent> ComponentClass) const//获取当前actor的所有componenttemplate<class T, class AllocatorType>    void GetComponents(TArray<T*, AllocatorType>& OutComponents, bool bIncludeFromChildActors = false) const//与FindComponentByClass作用相同,暴露给蓝图使用的C++函数UActorComponent* AActor::GetComponentByClass(TSubclassOf<UActorComponent> ComponentClass) const//获取指定类型的所有ComponentTArray<UActorComponent*> AActor::GetComponentsByClass(TSubclassOf<UActorComponent> ComponentClass) const

PrimitiveComponent.h

//获取当前component中材质的个数int32 UPrimitiveComponent::GetNumMaterials() const//创建一个材质对象,并替换到Parent对象上的指定index的材质UMaterialInstanceDynamic* UPrimitiveComponent::CreateAndSetMaterialInstanceDynamicFromMaterial(int32 ElementIndex, class UMaterialInterface* Parent)