hey guys. i’ve been looking around for long time now and i can’t find a similar question or explanation about this topic. i try to give you a simple look into my situation.
problem:
what i’m trying to do is to enable show mouse cursor when possessing a pawn. that works perfectly for the server but not for the clients. the cursor won’t show on the clients.
what am i doing:
i do have a playercharacter which enters a triggerbox to possess a new pawn. with the possession event i cast the playercontroller to enable the mouse cursor. for the server it shows, for the clients not.
the possession and the cast are properly set up (target and everything is set, i tried/watched/red alot about similar problems and i’m aware of the default input processing procedure).
so what am i missing? i know that the playercontroller is not replicated to the clients, so do i have a problem with that? do i need to bring that info back down to the clients?
i’m happy for every thoughts you got, really desperate looking for some hints… thanks alot in advance for thinking about it. just let me know if you need more info, because i haven’t found any similar topics about that problem…
I think Ive found part of the problem. When I set my show mouse cursor it still being run by the server even though I am in the clients “Spaceship.” See how it always says server. Any idea how to make that run on the actual client?
To show the mouse cursor, you’re using “Get Player Controller”, with the index set to 0. That works fine in a single player game where the player is alone, which means he’s 0, the first index.
In multiplayer however, the SERVER is always 0 - the first “player”. In a multiplayer game you should never use “Get Player Controller”, and instead reference certain controllers directly. In your case, you can simply set the index to 1, and client1 will have their mouse shown, however this is bad practice, UNLESS you will only ever have 2 players, server and client1.
Finally, the reason your print was showing “correctly”, server and client1, is because the both the server and clients have their own instance for basically everything, EXCEPT the playercontroller, where only ONE exists per player. This is super important to understand when coding for multiplayer… So, the print fires once for the server using its instance, and once for the client.
Thank you so much! You are a life saver. Totally makes sense. Would you happen to have a suggestion of where to set the “Show Mouse” that doesn’t use either get controller and is not bad practice?
The event gets called by my gamemode BP once post login.
Even doing what you show with a key event doesnt seem to get it to work(it does work on the server)