What should I use instead of “get player controller” to make a Multiplayer game (Top Down Game Unreal Engine)

|▌冷眼眸甩不掉的悲伤 提交于 2020-12-14 23:38:07

问题


Earlier in the day i figured out why my game doesn't work on multiplayer. The reason is that I use the "get player controller" which gives me the index 0 so i can't work. But i use this to get location where my player has to look at (for the get hit result under cursor) and I also use that for make spawn the projectile that my player launch.

Do you have an idea of what i could use to make my game work on multiplayer.

Here are 2 screen. Let me know if you need some other informations.

event to launch a projectile; function rotate to face cursor


回答1:


On the Character or Pawn, you can simply use GetController and cast it to a PlayerController




回答2:


Remember that you cannot get a client's player controller from another client. Controllers exist only on server and who owns it (the player).



来源:https://stackoverflow.com/questions/64902940/what-should-i-use-instead-of-get-player-controller-to-make-a-multiplayer-game

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!