#Player Movement/Ownership Issues

1 messages · Page 1 of 1 (latest)

somber badger
#

Nothing in your code looks to be wrong

#

What components are you using to sync movement?

#

Player Movement/Ownership Issues

frozen raven
#

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

somber badger
frozen raven
#

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

loud wave
#

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

frozen raven
#

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

loud wave
#

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

frozen raven
#

@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

loud wave
frozen raven
loud wave
#

If you are using network variables, yes

#

I'm pretty sure RPCs can still use strings though

frozen raven
#

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);
    }
loud wave
frozen raven
#

here are all scripts again

#

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

loud wave
#

I don't really have to time to go through those scripts but replacing strings with fixedstrings would be a good start

frozen raven
#

I see that I didn't make UI code NetworkBehaviour

#

Ima change it and try again

#

but I will also add fixed strings

#

I didn't add NetworkTransform to player prefab sadok