Author: Sephen Smothers
Posted on: 06/14/2024
The Problem:
The character controller in our game was initially having some issues between the client and the server. When a host server had a client connect, both the host and the client lost the ability to use their controller or keyboard and mouse to play the game. This would give obvious issues to the game, hover the biggest issue on the development side was that it halted any further progress into the development of the game for we had to get this working before we could move on.
The Solution:
The solution to the problem lied in the code. For some background information, we are using Unity Net Code to get the multiplayer functionality in our game. The network manager takes in a player prefab and copies it every time a client is connected. To get the character controller working I had to check if a client is the owner of that controller in the start function and then initialize the variables. Otherwise, if a client is not an owner of the network space, it will skip it. This caused the controllers to not be shared between clients and then they all received their own version. Lastly the Net Code API is something us as developers on this team is still new to us and we work to provide the best experience to our users.
Did you like this post? Tell us
Leave a comment
Log in with your itch.io account to leave a comment.