Search Unity

GUI elements depending on local player

Discussion in 'Multiplayer' started by deLord, Nov 19, 2016.

  1. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    I searched through a few example projects but I couldnt find what I am searching for. Maybe I just need the proper pointer.

    Currently I am developing a turn-based board game. The GUI is the same for every player, except every player will see HIS stats on the right and the other players' stats on the top. But how do I accomplish that?
    I figured I need NetworkIdentities which I already added to my players but I have no idea how to implement what I want to.

    Every player sees the blue area with his stats, the enemies will only be visible within the small red area which lacks some information and the green area is synchronized between all players. Any help/pointers/examples are greatly appreciated :)
     

    Attached Files:

  2. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    I know this Q prolly screams like "RTFM" but I did and somehow I did not understand how to do it properly. So a pointer to a good tutorial or just the right paragraph in the manual could help. btw using Unity 5.4.2f2

    Also: If [SyncVar] can not contain complex objects, then what do I need to do instead? I highly doubt one has to refactor all his code to break everything into structs but rather that SyncVar is a shortcut IF you have specific, individual variables that have a base type. Right? So the intention is never to use SyncVar for tasks like this.

    I have a TileManager that has a 2D array of Tile. Tile is a complex object containing other complex objects and is also used as a prefab with connection to objects already set in the scene. So this makes the SyncVar way impossible in my understanding.
     
    Last edited: Nov 21, 2016
  3. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    I didnt find any information on these error messages which I cannot explain

    ................................
    Unloading 5 Unused Serialized files (Serialized files now loaded: 0)
    UnloadTime: 1.537590 ms

    Unloading 4 unused Assets to reduce memory usage. Loaded Objects now: 1714.
    Total: 1.655149 ms (FindLiveObjects: 0.074640 ms CreateObjectMapping: 0.047583 ms MarkObjects: 1.518464 ms DeleteObjects: 0.007464 ms)

    ICH BIN *AWAKE* IM GAMEMGR
    (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

    OnObjSpawn netId: 8 has invalid asset Id
    (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

    OnObjSpawn netId: 9 has invalid asset Id
    (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)
    .....................
    OnObjSpawn netId: 127 has invalid asset Id
    (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

    Player:: lokal, nichts passiert PlayerPrefab(Clone)
    (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

    NullReferenceException: Object reference not set to an instance of an object
    at ActivePlrHelper+<axaxax>c__Iterator6.MoveNext () [0x00000] in <filename unknown>:0
    at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0

    The number of errors is exactly the number of objects that I spawned.

    Help, I cannot find any info on this :/
     
    Last edited: Nov 22, 2016