Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
8
Question by camtheman177 · Jan 16, 2016 at 11:58 PM · cameranetworkingnetworkcamera-movementmultiple cameras

Network Multiple Cameras

I am reasonably new to Unity and have been working through the Unity tutorials, specifically the Survival Shooter. I thought I may have a go at converting this tutorial game to a network multiplayer.

The camera in this tutorial follows the player from a fixed rotation. To accomplish this the tutorial uses one camera (Not a child of the player), tracks the players position and updates the camera position accordingly.

I want each player who joins the network game to have the camera to follow their character with a fixed rotation (same as the tutorial).

I first attempted this by instantiating a new camera for each player, but I found that the new camera was overriding the last. I also attempted to disable the other cameras if they were a local player but found that the other players cameras were being disabled when a new player joined.

I then scrapped the multiple camera idea and attempted to use one camera, but with a similar result where it would only track the latest player.

What is the correct solution to network multiplayer cameras that are not a child of the player?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image
9

Answer by _Spanda_ · Jul 23, 2016 at 04:43 PM

     public Camera cam;
 
     void Update () {
 
         if(!isLocalPlayer)
         {
             cam.enabled = false;
             return;
         }

I had the exact same problem, and this solution I came up with. Have a good day!

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Beater2022 · Jan 28, 2017 at 10:53 PM 0
Share

Thanks, I was having the same problem and it fixed it. Im not entirely sure why (noob I know sorry), but this didnt work in void Update for me ins$$anonymous$$d it works in void start. Not complaining just glad it works.

Anyway thanks again. :)

avatar image ChicoCrash · Dec 08, 2018 at 07:02 PM 0
Share

THE CODE THAT IS SHOWN AS A CLASS IS CALLED?

avatar image kill390 · Oct 30, 2020 at 12:50 PM 0
Share

THANKS PRO

avatar image
0

Answer by rattler22snake · Aug 09, 2018 at 01:44 AM

Wow thanks dude. I just got this problem and instead of hitting my head against a wall for hours trying to figure it out on my own I looked it up. Lots of help. Much Thanks

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Louisicraft · Mar 27, 2021 at 01:56 PM

when i do this it ignores all culling Masks on the connecting clients and culling Mask don't work at all on this Camera anymore! Please Help

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by harunakdogan · Jul 02, 2021 at 12:27 AM

Just attach a Camera to the Player preFab and add this line to the Start method of the Player script:

 GetComponent<Camera>().enabled = isLocalPlayer ? true : false;




Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

66 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Photon camera problum 0 Answers

How to prevent other players from activating triggers for all players? 0 Answers

How to make multiplayer with multiple local cameras? 1 Answer

UNET (Multiplayer) calling [command] function twice 0 Answers

What is NetworkTransport.Shutdown() doing? When I must to call it? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges