Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

hiding/showing things to certain players

Discussion in 'Multiplayer' started by Alec, Jan 23, 2009.

  1. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,330
    In an online fps, how could I show a character model that represents the player to other people, but the actual player cannot see?
     
  2. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Easiest solution is probably having a game object that only has the scripts, NetworkView and colliders etc. attached - but not an actual model. Then, for the player, don't do anything [EDIT: actually, you might want to attach a camera ;-) ] - for the others: Locally instantiate a model and attach it below that game object.

    So that would be for the other players:

    Code (csharp):
    1.  
    2. PlayerObject
    3. - PlayerModel
    4.  
    And for the player:

    Code (csharp):
    1.  
    2. PlayerObject
    3. - Camera
    4.  
    Sunny regards,
    Jashan
     
  3. jeffcraighead

    jeffcraighead

    Joined:
    Nov 15, 2006
    Posts:
    740
    Or have a single prefab that has all that and then enable/disable certain components depending on whether the object is local or remote.
     
  4. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,330
    which is the easiest way?
     
  5. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    That depends ;-) ... my guess would be that Jeff's solution is probably quicker to set up (and thus could be considered "easier"). However, if you consider implementing your own LOD-system, you might be better off if you started with my solution right away (at least that's what I'm thinking now that I have implemented things the other way ;-) ).