与BP的类参考的c ++等效?

问题描述 投票:0回答:1

我正在将BP转换为C ++,并且所涉及的变量是类引用;

C ++等效项是什么?

TSubclassOf?类型*-> StaticClass()?

我知道我对此有过多思考。

enter image description here

c++ unreal-engine4 unreal-blueprint
1个回答
1
投票

等价物为TSubclassOf,但是要获取对特定类的引用,则可以使用ClassName :: StaticClass(),因此,例如,如果您想要一个允许所有Pawn类型但默认值为MyGameCharacter的下拉列表,则代码为:] >

UPROPERTY(BlueprintReadWrite, EditAnywhere)
TSubclassOf<APawn> PawnType;

void MyClassConstructor()
{
    PawnType = MyGameCharacter::StaticClass();
}
    
© www.soinside.com 2019 - 2024. All rights reserved.