Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Third Party [PUN+] Instantiating prefab works, but movement doesn't

Discussion in 'Multiplayer' started by Kovenant, Jan 19, 2015.

  1. Kovenant


    Sep 18, 2013
    Hi all..

    I'm trying to create a simple multiplayer FPS using the Realistic FPS Prefab asset together with PUN+..
    I'm totally new to this networking stuff.. I'm trying to instantiate a prefab over the network, which works - my player spawns where intended, but he can't move at all. The only thing that works is the MouseLook but I can't walk, crouch, jump, shoot or anything..

    Does the PhotonView need to be on every childobject of my Player Prefab?

    If I don't instantiate the player over the network, but drag the prefab onto the scene instead from the project folder - everything works just fine..
  2. tobiass


    Apr 7, 2009
    The PhotonView can't guess what your character can do or currently does, so you have to write some code that sends the current state to the other players and some more code to apply incoming updates to the characters of other players.
    You only need one PhotonView to do so but you need a script to "observe", which implements OnPhotonSerializeView (you can make that script class implement the interface IPunObservable).

    Check the Marco Polo Tutorial or even better the Merry Fragmas videos!