Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
0
Question by nixtwiz · Sep 23, 2012 at 09:44 PM · networkingmultiplayerfpsclienttps

FPS Multiplayer setup - TPS models for other clients

I cannot figure out how to have a first person model for the client playing and a third person model seen by them for every other client.

Are there any good tutorials on this or could someone at least give me a basic idea how to do this? I've searched everywhere and can't find anything that fits what I'm looking for. My client/server setup is based off of the Unity Networking Tutorial. Players can connect (from both mobile and PC) to the server, I just can't get the spawn setup to work.

Movement syncing DOES work if I allow it to spawn first player setups on each client, but floating weapons don't really make sense. I have a spawn object on the map, but its network view seems to be only the server (I've tried doing the spawning using networkView.isMine) and i've tried Network.instantiate to make a local spawn point for everyone, but that doesn't work either and wouldn't solve movement syncing.

Any help is appreciated.

Comment
Add comment · Show 1
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 nixtwiz · Sep 23, 2012 at 10:48 PM 0
Share

Alright a little update. I've found one way to do it is to have the FPS and TPS models spawned, but then delete the mesh for the one not needing to be rendered. This seems like it'd work, but this is aimed for mobile and it seems like it might be inefficient. Is there a better way?

Also something to add, my player is a custom rigidbody setup and I am using the NetworkRigidbody.cs from the Networking Tutorial to sync movement.

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by nixtwiz · Sep 24, 2012 at 02:36 AM

Solved my own problem. Went with spawning the first and third player setups in the same prefab and then deleting one depending on networkView.isMine. Here's the code I used for anyone that needs it. This code would go on the player prefab that is instantiated, and the BodyMesh and FirstPersonSetup are set in the inspector from objects in this prefab.

 function Awake(){
         //on spawn, check if this object is controlled by the client
     if(networkView.isMine){
          //if it is, delete the third person mesh
              Destroy(BodyMesh.gameObject);
             //Set everything else the Player needs on startup
     }
     else{
                 //if it isn't, delete the first person setup
         Destroy(FirstPersonSetup.gameObject);
     }
 }
 function Update(){
         if(networkView.isMine){
              //if object is the client's
             //control code goes here
         }
 }
Comment
Add comment · Show 4 · 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 HSMInteractive · Nov 07, 2013 at 08:26 PM 0
Share

I've tried this for photon and it didn't work. Any suggestions?

avatar image nixtwiz · Nov 10, 2013 at 11:32 PM 1
Share

Sorry haven't worked with Photon. You'd probably be better off asking that as a new question or starting a thread in the forums (Unity and ExitGames). I can't imagine it'd be too different though, but I'm guessing it has its own version of "networkView.is$$anonymous$$ine" so you might want to look into that.

avatar image HSMInteractive · Nov 12, 2013 at 10:35 PM 0
Share

Alright. I've asked on here and haven't gotten a response yet so I guess it's off to ExitGames :/

avatar image AlucardJay · Nov 12, 2013 at 11:00 PM 1
Share
 if ( photonView.is$$anonymous$$ine )
 {
     // do stuff
 }

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

12 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

Related Questions

Unity networking tutorial? 6 Answers

Using AssignClientAuthority 0 Answers

Network Multiplayer 0 Answers

Networking Unknown message ID 0 Answers

Unity Multiplayer - OnStartLocalPlayer() called multiple times 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