添加一个碰撞组件(例如:Sphere Collision)。 在碰撞组件的OnComponentBeginOverlap事件中,使用Cast To BP_Character节点确认其他物件是角色蓝图的实例。 调用角色的IncreaseHealth函数,并传递一个值(例如,HealthAmount变量)。 Event OnComponentBeginOverlap (Other Actor) Cast To BP_Character (Other Actor) Is Valid?
然后可以将两个需要通信的Actor都拖拽到关卡蓝图中,然后进行属性或函数的访问。 1.2 Get Actor of Class/Get All Actors of Class 利用Get Actor of Class(获取类的Actor)或Get All Actors of Class(获取类的所有Actors)这两个节点获得场景中的Actor。 这两个节点的区别是一个获取一个Actor(第一个实例化的Acto...
解决方法:使用Asset Registry,通过Get Asset by Path来获取给定路径下的资产数组,再对资产数组进行遍历,选出(Get Full Name&Contains + Get Class)并加载(Get Asset)所需的资源,最后储存到变量(Cast To <变量类型>)中 如何获取资产的相对路径: 选中一个资产→右键→复制引用,获得该资产类型+该资产所在得相对位置...
if(const ARPGGameMode* GameMode = Cast<ARPGGameMode>(UGameplayStatics::GetGameMode(this))) { ... SaveGameData->bFirstTimeLoadIn = false; //保存完成将第一次加载属性设置为false if(!HasAuthority()) return; URPGAbilitySystemComponent* RPGASC = Cast<URPGAbilitySystemComponent>(AbilitySystemCompone...
(NewAbilityCDO);22returnHandle;23}2425//为技能绑定按键事件26voidAAbilityCharacterBase::BindAbilityToAction(UAbilityOwned*AbilityCDO)27{28if(!AbilityCDO)29return;3031APlayerController* PlayerController = CastChecked<APlayerController>(GetController());32if(!PlayerController)33return;3435UEnhancedInput...
UGameplayStatics::GetAllActorsOfClass(InWorld, APostProcessVolume::StaticClass(), arr_pp); APostProcessVolume*PP = Cast<APostProcessVolume>(arr_pp[0]);//arr_ppCaptureRTT->Initilize(size * factor, location, rot,90.0f,200.0f,false,true, PP); ...
// 反射功能 获取反射生成的类StaticClassUClass*pStaticClass=pObj->GetClass();if(pStaticClass){// 获取字段指针FProperty*pProperty=pStaticClass->FindPropertyByName(FName(TEXT("CurPlayerName")));// 转换为对应的字段类型 static_castFStrProperty*pStrProp=CastField<FStrProperty>(pProperty);if(pStrPr...
转换成需要的类型, CastField<FTargetTypeProperty>(FProperty) 然后通过FProperty的内置函数把参数读出来FTargetTypeProperty->GetPropertyValue_InContainer(Target) 这边需要注意FProperty是4.25以后版本中对外暴露的项取代了之前的UProperty,早些的文章中可能会使用UProperty,本文以5.1为演示平台,使用时注意版本对应。
Cast Getting a Variable Breaking a Struct Function Entry Self3.3.4 All Public Functions Should Have A DescriptionThis rule applies more to public facing or marketplace blueprints, so that others can more easily navigate and consume your blueprint API.Simply...
类似于dynamic_cast、static_cast和const_cast运算符。 shared_ptr 相关 1 解决环式指向问题:weak_ptr 2 获取自身对象的智能指针:shared_from_this() 3 多组智能指针管理问题: 不可用1个raw pointer构造多个shared_ptr weak_ptr 无拥有权,可复制,可移动 ...