Search Unity

More than 1 Prefab with Networkidentity component set to LocalPlayer Authority?

Discussion in 'Multiplayer' started by eco_bach, Dec 15, 2017.

  1. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    Hi
    Trying to troubleshoot a 2 player, turn based, board game application.
    Right now I have assigned the actual game board and game pieces as the Player Prefab using the Lobby manager class.
    Since this board game is actually comprised of 2 boards it makes the most sense (after configuring their board each player sees 2 boards at game time, theirs and their opponent)

    For the actual tiles that comprise the game board I am using a separate Prefab. These are instantiated at runtime to create a 8x8 grid. These board tiles need to know when they are occupied and also what type of game piece is occupying it.

    My main problem is that my board tiles only work for the LocalPlayer. ie they don't 'remember' their occupied state defined during configuration for the remote player.

    Have also tried spawning these board tile prefabs AFTER I instantiate them with
    Code (csharp):
    1. NetworkServer.SpawnWithClientAuthority(_tileInstance, connectionToClient);
    Both the Player Prefab and the Tile Prefab have a NetworkIdentity component with LocalPlayer authority set.

    Does the above logic seem correct?


    I'm wondering if one flaw in my architecture is that the Tile Prefabs are actually instantiated INSIDE each Player Prefab?

    Any UNET experts able to suggest a better alternative?
    Have been trying to get this to work now for almost a MONTH! so any feedback welcome...
     
    Last edited: Dec 15, 2017