#Player Movement/Ownership Issues
1 messages · Page 1 of 1 (latest)
Nothing in your code looks to be wrong
What components are you using to sync movement?
Player Movement/Ownership Issues
I just set player prefab and added to it network gameobject component
I also added it to list
Thing is that before adding nicknames it worked perfectly fine
So basically there was no nickname related variables or checks in NetworkUI.cs and there was no PlayerNicknames.cs
You need some sort of NetworkTransform added to the player to sync movement
Actually I might have realized smt
I am using linux and windows that lock are weird. So maybe input was taken from windows active while I was in unity
But then why was client windows frozen
Client Button was grey, meaning it froze
You'll need to make sure that there is only one main camera in the scene, if the camera is part of the player prefab then the remote players will need to disable them
But then why it worked fine before???
Before adding nicknames it worked fine
And if I do have to do that, then how can I do that
It's my first multiplayer project
In your movempent script, in OnNetworkSpawn() you can check for IsOwner then disable the camera
no clue how that was working before. only one camera will display at a time
@loud wave I did disable all camera s but still issue persists. My dad's laptop when trying to connect console throws error when connecting to the server
I see smt is wrong
when I'm testing on the same machine and I try to connect player spawns but client is stuck on frozen game and unity threw this error
This might fix that issue
https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/issues/2920
so I have to use FixedString?
If you are using network variables, yes
I'm pretty sure RPCs can still use strings though
then how do I fix my code
The only thing I changed from then is added this to Movement.cs
public override void OnNetworkSpawn()
{
if (!IsOwner) playerCamera.gameObject.SetActive(false);
}
this code has nothing to do with strings, so its not causing that error.
ye ik
here are all scripts again
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
note that the version for Movement.cs I sent here doesn't have the camera turning off I added alr cuz I'm too lazy to create new hastebin
I don't really have to time to go through those scripts but replacing strings with fixedstrings would be a good start
