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

I can't move my player in multiplayer

Discussion in 'Multiplayer' started by mmc_unity, Jul 25, 2017.

  1. mmc_unity

    mmc_unity

    Joined:
    Oct 16, 2016
    Posts:
    6
    Hi, I have a top down space shooter game for android and the movement input is like in the unity's tutorial. When I go online the spaceship is spwaned and shoots but I can't move it around. I watched the multiplayer tutorial and I followed all the instructions. I don't understand what I am missing. Can someoane help me?
     
  2. JoeGyl2000

    JoeGyl2000

    Joined:
    Jun 25, 2013
    Posts:
    1
    I have the same problem, can someone please answer on this thread. Did you solve it?
     
  3. Fimgers

    Fimgers

    Joined:
    Aug 28, 2013
    Posts:
    35
    Off the top of my head and with the info you have provided check to see if your characters network identity is set to local player, typically there is a check in the input function to return if its not the local. If this does not work try putting some debug logs in the input function to make sure that is working correctly as well with the movement function.
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    I haven't looked at whichever multiplayer tutorial you're referring to, but character movement with the UNet HLAPI for beginners is typically done via two methods.

    1) Make the player object have client or local authority, and move the player object around on the client with authority similarly to how you would in a single player game. You should check for either hasAuthority or isLocalPlayer before attempting to process any input on that player object or attempting any movement. Movement done on the client with authority is propagated to the server via NetworkTransform, which then propagates it to the other clients

    2) Make the server have authority over the object, and handle movement by taking input from the player checked by isLocalPlayer, and send those inputs to the server via a Command on the player object. The movement is then executed on the server, and propagates to all clients, including the client that the player object is for.

    If you need specific help with your code, no one is going to be able to give you specific answers without seeing your code. So you can post it here, and make sure you use code tags. No one can help you fix a problem when the most detail you've given is that you have some problem with moving around. That can be almost anything.
     
    brainwipe likes this.