UE4 C 網路聯機基礎(3)

2021-08-21 17:22:10 字數 465 閱讀 6185

如果伺服器需要對客戶端廣播執行乙個函式可以使用ufunction(netmulticast),

因為gamemode只在伺服器中執行,所以通常這種廣播執行可以在gamemode中指定gamestate來呼叫該函式

實現伺服器廣播客戶端執行。

gamemode中獲取gamestate方法:

amygamestate * gs = getgamestate();

需要獲取到所有pawn可以使用這種迭代方法:

for ( fconstpawniterator  it = getworld()->getpawniterator();  it ; it++)

獲取到所有playercontroller迭代方法:

for ( fconstplayercontrolleriterator  it = getworld()->getplayercontrolleriterator();  it ; it++)

UE4 C 網路聯機基礎(1)

若要允許當前actor可以被伺服器複製 setreplicates true 若要允許當前actor可以被伺服器複製移動 setreplicatesmovement true 客戶端若要通知伺服器呼叫函式 函式紅引數為ufunction server,reliable,withvalidation ...

UE4 C 使用反射

使用 ufunction rightfunc this findfunction fname text onrightmousepressed if rightfunc processevent rightfunc,nullptr 藍圖直接使用藍圖物件根據方法名取得方法 注意 onrightmous...

UE4C 建立列舉

目錄 一 目的 1 想 ue4使用c 建立列舉變數適用於c 與藍圖 二 參考 1 ue4使用c 建立列舉變數適用於c 與藍圖 三 注意 1 c 類最好是actor型別,發現gamemodebase型別我在場景中沒有找到 四 操作 1 新建actor的c 類mygamemodebase.h 1 myg...