Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
atilano1

Multiplayer camera bugs

Question

well guys I have a problem, project I'm creating, the problem is: when I create the server it instantiates the player normally, but when I connect to another game window but it instantiates the second player that was instantiated is in the camera first player. as fasso second pro player get on camera player 1 and player 2 get on camera the first player instantiated?

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0

Yes, this is exactly what all tutorials show, what they do is network.instantiate a player, in awake they check if !view.ismine -> remove camera and audio listener. But in reality the best way of doing would be creating two player prefabs, 1 for player itself, and second for clone prefab. For clone prefab you need only movement and animations script, no camera, audio listeners, extra scripts like weapon lists etc.

When instantiating, check if view.ismine (this is your scene) -> spawn normal player, else (this player is not you) -> spawn clone. 

Share this post


Link to post
Share on other sites

  • 0
Please login or register to see this quote.

 

Yep, beat me to it.

You need to check if the network view is the clients

Share this post


Link to post
Share on other sites
  • 0

See your instantiate player in inspector for each clone and check individual camera.

What do you use to create server/client side ? Photon or other asset ?

I think your problem is inside prefab which you instantiate each player in scene ++

Share this post


Link to post
Share on other sites
  • 0

We know exactly what is happening.

Before instantiating your player prefab, you need to check if the network view is yours, and then disable/activate the player camera if the network view is yours.

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

 

you mean after instantiating right ? How can you disable something that isnt in the scene ?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...