update: 2016/11/19
reference:
1. Casting types in Unreal Engine | Orfeas Eleftheriou
2. I touchs: Unreal: Adding a C++ Class
3. I touchs: Unreal: Exposing C++ variables to Blueprints
4. I touchs: Unreal: Exposing C++ functions to Blueprints
5. I touchs: Unreal: Add Override C++ Event Functions in Blueprints
6. I touchs: Unreal: Create C++ Blueprint Function Library
A. 新增 C++ 類別
1. 可以接續 I touchs: Unreal: Create C++ Blueprint Function Library 的專案
2. Add New > New C++ Class...
3. 選擇 "Actor" 作為 Parent Class > Next
-----------------------------------------------------------------------------------------------
B. 新增指標宣告與 Casting 處理
1. 修改: CActor.h
....
//@add ######
UPROPERTY(EditAnywhere)
AActor* SM;
....
....
//@add ######
AStaticMeshActor* StaticMesh = Cast<AStaticMeshActor>(SM);
if (StaticMesh)
{
GLog->Log("The actor you chose is a static mesh actor!");
}
....
-----------------------------------------------------------------------------------------------
C. 新增繼承自 CActor 的 Blueprint 類別:
1. Add New > Blueprint Class
D. 測試
1. 將一個 Cube 與 BP_CActor 拖拉到場景.
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。