Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity 2017 hangs when Launching - GenerateConstants

Discussion in 'Editor & General Support' started by Bailywick, Oct 6, 2017.

  1. Bailywick

    Bailywick

    Joined:
    Mar 11, 2015
    Posts:
    17
    I've just upgraded to Unity 2017.1 (and the new version of .net) and am trying to get my project working but I've run into a very odd issue:

    When I try and open my project in unity the I get the "Compiling Scripts" message but unity hangs there, using lots of processor. Digging into the unity editor log I found it was stalled at:

    After a lot of poking of the class I found the line causing me an issue is:
    Code (CSharp):
    1. private readonly SyncModelValueList _syncModelValues = new SyncModelValueList();
    If I comment out this line then I can open the project, then uncomment it and it will cause the editor to hang as it tries to compile it.

    This is referencing:
    Code (CSharp):
    1. class SyncModelValueList : SyncListStruct<SyncModelValue> { }
    SyncModelValue is a struct containing two strings and a byte (as well as a few functions to use the data).
    I

    have tried just about everything I can think of (examples include, changing visibility of variable and referenced classes, removing readonly from variable, initializing in the constructor, changing the name of the classes, changing the name of the variable, moving declarations around inside the cs files).

    Anyone got an idea what could be happening?
     
    Last edited: Oct 6, 2017
  2. Bailywick

    Bailywick

    Joined:
    Mar 11, 2015
    Posts:
    17
    I finally tracking this one down: https://issuetracker.unity3d.com/is...-when-class-inherits-a-networkbehaviour-class

    It occurs for any kind of sync list as far as I can tell (SyncListBool SyncListInt, SyncListStruct etc).
    It only occurs if the class is not directly descended from UnityNetworkBehaviour.
    Code (CSharp):
    1. class CustomBehaviour : NetworkBehaviour
    2. {
    3.     private SyncListBool syncList; //this will work
    4. }
    5. class HangBehaviour: CustomBehaviour
    6. {
    7.     private SyncListBool hangList; //this line will cause the hang
    8. }
    I've worked around it locally by moving the SyncList declarations into base class and then only setting them up the classes that use them - not ideal but it works till a fix is released.