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.
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…
Im having the same issue. My server has a mouse and works fine, but the client wont show it.
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?
Sure I also made a really quick video
I guess my question is where should I set the show mouse cursor. The level blueprint appears to run on both Server and client. Is this correct?
Thanks. The first frame of the video showed the problem x)
I’ll post an answer to explain
You are awesome! thanks:)
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.
P.S. cool looking game.
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?
lmao I just realized you’re not OP. Oh well, the answer is for you and not him !
The answer may work for him tho, hopefully
lol I know! I would totally mark it answered it I could.
I’d do it in the player controller BP
Actually, I DO do it there:
yeah I just want muh karma
LMK if you’re still having issues though
Ok this was where I had it before so I must be doing something wrong. Sorry to keep bugging you. This is what I had before
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)
I was doing both of these in my player controller BP
“SpaceshipCaptain” is your player controller?
I can help out quicker if you’d like on discord or some other chat. Not a big fan of extended discussion on the answerhub comment section ya know
Yessir. It Extends the PlayerController class
Not sure my last comment got posted. Have you tried setting the index of Get Player Controller to 1 to see if that works as expected?