BUG: SyncListStruct only works with some file names

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:

using UnityEngine;
using UnityEngine.Networking;

[System.Serializable]
public struct Skill {
    public string name;
    public bool learned;
    public float castTimeEnd;
    public float cooldownEnd;
}

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.

2499944–172754–SyncListStruct fails depending on Filename.zip (37.2 KB)

2 Likes

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!!

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.

Yes, it’d be really interesting to know what causedd it, it has no much sense xD

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.

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.

Ofcourse :slight_smile:

Oh, must have missed it. Thanks a lot!

This should need no voting at all since it really severe. At least we could dream : )

No wonder… At first, I dismissed this (and most online activity) because of the April Fool’s.

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…

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.

1 Like

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.

This was reported fixed in 5.4.3. but it still happens and even the same work around works.