UE4 C++如何从UchildactorComponent调用方法?
UPROPERTY(Category=Weapon,EditAnywhere,meta=(AllowPrivateAccess="true"))
UChildActorComponent*ClientWeapon;
UPROPERTY(VisibleAnywhere,Category="Weapon")
TSubclassOf<AWeaponBaseClient> WeaponClientClass;
UPROPERTY(VisibleAnywhere,Category="Weapon")
TSubclassOf<AWeaponBaseServer> WeaponServerClass;
UPROPERTY(Category=Weapon,EditAnywhere,Replicated,meta=(AllowPrivateAccess="true"))
UChildActorComponent*ServerWeapon;
这是由头框创建的UchildactorComponent。
ClientWeapon->SetChildActorClass(WeaponClientClass);
ServerWeapon->SetChildActorClass(WeaponServerClass);
ClientWeapon->CreateChildActor();
ServerWeapon->CreateChildActor();
在CPP文件,构造功能中,我启动了UchildactorComponent。
现在,我需要ClientWeapon的呼叫功能,您能告诉我如何铸造ClientWeapon- getChildActor吗?
UPROPERTY(Category=Weapon,EditAnywhere,meta=(AllowPrivateAccess="true"))
UChildActorComponent*ClientWeapon;
UPROPERTY(VisibleAnywhere,Category="Weapon")
TSubclassOf<AWeaponBaseClient> WeaponClientClass;
UPROPERTY(VisibleAnywhere,Category="Weapon")
TSubclassOf<AWeaponBaseServer> WeaponServerClass;
UPROPERTY(Category=Weapon,EditAnywhere,Replicated,meta=(AllowPrivateAccess="true"))
UChildActorComponent*ServerWeapon;
this is UChildActorComponent Create by headfile.
ClientWeapon->SetChildActorClass(WeaponClientClass);
ServerWeapon->SetChildActorClass(WeaponServerClass);
ClientWeapon->CreateChildActor();
ServerWeapon->CreateChildActor();
in cpp file,construction function,I initallize the UChildActorComponent.
now I need call function from ClientWeapon,can you tell me how to cast to ClientWeapon->GetChildActor?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
clientweapon
是uchildactorcomponent
。要访问您的演员,您需要从组成部分中获得儿童演员,然后将其扔给您的班级
ClientWeapon
is aUChildActorComponent
.To access your Actor, you need to get the Child Actor from the component and then cast it to your class