Search Unity

Unity Multiplayer BUG: SyncListStruct only works with some file names

Discussion in 'Connected Games' started by vis2k, Feb 7, 2016.

  1. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    3,242
    The Bug:
    The project contains a player class, which has a SyncListStruct of type Skill. The synclist is NOT synced to clients if the Skill struct is in a file with the name Skill.cs, but it works with other files names (the struct name itself always remains 'Skill'). Here are the file names that I tested. Red means the bug happens, green means everything is fine:
    • Skill.cs
    • SkillFix.cs
    • S_kill.cs
    • SkillCopy.cs
    • FuSkill.cs
    • FSkill.cs
    • XSkill.cs
    • xSkill.cs
    • WTFSkill.cs
    • BuggySkill.cs
    • ItemCopy.cs
    Let me repeat this: the code (and name) for the skill struct is always the same:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Networking;
    3.  
    4. [System.Serializable]
    5. public struct Skill {
    6.     public string name;
    7.     public bool learned;
    8.     public float castTimeEnd;
    9.     public float cooldownEnd;
    10. }
    11.  
    12. public class SyncListSkill : SyncListStruct<Skill> { }

    How to reproduce:

    • Open the attached project, open the scene file, build the project.
    • Select "LAN Server" in the build
    • Select "LAN Client" in the Editor
      • Take a look at the Player object in the Inspector and see how the SyncList is empty, even though it should have one entry (this is the bug)
    • Close the build, stop the Editor
    • Rename the Skill.cs file to BuggySkill.cs and repeat the process to see how the SyncList now has one entry as it should
    Test Environment:
    Linux Mint 17.2 64 bit with Unity for Linux Version 5.3.1f1.

    A very similar file name related bug was already reported as #737241 in FogBugz last October, without any response.

    It would be really nice if someone from the UNET team fixes this bug or at least confirms it.
     

    Attached Files:

    Last edited: Feb 24, 2016
    MrLucid72 and dearamy like this.
  2. Xuzon

    Xuzon

    Joined:
    Mar 21, 2014
    Posts:
    83
    WOW! I was struggling my head because I thought that I was doing something wrong to the synclist but you're right, I've changed mi filename from playerStruct.cs to SPlayer.cs and it worked perfectly!!

    Thanks m8!!
     
  3. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    3,242
    You are welcome. Someone from the Q&A team also confirmed it a few days ago. He said he'll forward it to a developer. It would be really interesting to know what caused it.
     
  4. Xuzon

    Xuzon

    Joined:
    Mar 21, 2014
    Posts:
    83
    Yes, it'd be really interesting to know what causedd it, it has no much sense xD
     
  5. ecesis_llc

    ecesis_llc

    Joined:
    Aug 3, 2015
    Posts:
    58
    Thanks for posting this. I couldn't for the life of me figure out why one list worked but my other list didn't. They both were using the same struct for their list. The Add command would show it fired but nothing would be added. After renaming the struct and the SyncListStruct it works.
     
  6. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    3,242
    You are welcome. This also happens for 'Quest.cs' and works fine with 'BuggyQuest.cs' by the way.

    @gintautass any chance to get this on the issue tracker so that we can vote on it? It was confirmed as #737241 at April 1st.
     
  7. gintautass

    gintautass

    QA Minion Unity Technologies

    Joined:
    Oct 27, 2015
    Posts:
    42
  8. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    3,242
  9. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    This should need no voting at all since it really severe. At least we could dream : )
     
  10. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    966
    No wonder... At first, I dismissed this (and most online activity) because of the April Fool's.
     
  11. zalo10

    zalo10

    Joined:
    Dec 5, 2012
    Posts:
    14
    Looks like it's possibly execution order related; might be due to Unity executing your scripts in alphabetical order.

    There's an Execution order sub menu in the Project settings that allows you to manually override this...
     
  12. UnityEngine

    UnityEngine

    Joined:
    Dec 26, 2015
    Posts:
    1
    THIS NEEDS TO BE FIXED. THIS PROBLEM HAS TOOK ABOUT A MONTH OF MY LIFE, JUST TO SYNC A LIST OF STRUCTS. THIS IS UNACCEPTABLE AND IF THIS IS NOT ADDRESSED AND FIXED SOON, I WILL GIVE UP ON UNITY ENGINE AND MOVE TO UNREAL.
     
  13. DRRosen3

    DRRosen3

    Joined:
    Jan 30, 2014
    Posts:
    642
    Threatening to move to Unreal won't get the problem fixed any faster. The developers have MANY aspects of the engine to work on, not just UNet. Besides, ONE person with a SINGLE forum post switching to Unreal won't really hurt them in the long run. If you were a more reputable member of the community with some published professional works, then maybe they'd feel like losing you is a big deal.
     
  14. arzi42

    arzi42

    Joined:
    Sep 16, 2016
    Posts:
    10
    This was reported fixed in 5.4.3. but it still happens and even the same work around works.