# ue5 tower defence **Repository Path**: cn-code/ue5-tower-defence ## Basic Information - **Project Name**: ue5 tower defence - **Description**: No description available - **Primary Language**: C++ - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2024-07-18 - **Last Updated**: 2024-08-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ue5 tower defence #### Description {**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} ### 知识点: ###### 1.Actor迭代器,获取场景中指定类型的Actor。 ```c++ for (TActorIteratorit(GetWorld(), ATowerZD::StaticClass()); it; ++it) { ATowerZD* TheCharacter = *it; } ``` ###### 2.指针 ```c++ // 弱指针 TWeakObjectPtr Target; // 获取弱指针中的对象 Target.Get(); // 对象类型,一般存储需要实例化的对象类型 TSubClassOf<> // 对象实例指针。一般存储对象实例。 TObjectPtr<> // 软引用,用到的时候才会加载到内存。 TSoftObjectPtr<> TSoftClassPtr<> // 方法可检查资源是否已准备好可供访问; TSoftObjectPtr.IsPending() // 如果被引用资源存在于内存中,将返回这个资源对象 TSoftObjectPtr.Get() ``` 3.TArray ```c++ TArray ActorAttay; // 清空数组 ActorAttay.Empty(); // 数组是否为空 ActorArray.IsEmpty(); // 获取数组长度 ActorArray.Num(); ```