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

Why Unity Editor Response so slow when I click an inspector button?

Discussion in 'Editor & General Support' started by zhoy, Mar 24, 2015.

  1. zhoy

    zhoy

    Joined:
    Mar 24, 2015
    Posts:
    10
    The Inspctor is drawing my custom Editor.
    When I click one button on it.
    The OnInspectorGUI function return immdiately. But its next event coming in 10 minutes or more .The Data to serialize is too big>?..I don't know why?

    But it shoud not be so serious!
    Who can help me >>?
     
  2. proandrius

    proandrius

    Unity Technologies

    Joined:
    Dec 4, 2012
    Posts:
    544
    Can you show the code?
     
  3. zhoy

    zhoy

    Joined:
    Mar 24, 2015
    Posts:
    10
    too big program. almost 4000 lines.can u tell me your email proandrius.I send it to you.and tell u how to reapear it
    Its an asset i bougnt in assetstore.
    There's no problem the other day before i modified some code. but its not work even i modify it back.

    Thank you ,dear proandrius
     
  4. proandrius

    proandrius

    Unity Technologies

    Joined:
    Dec 4, 2012
    Posts:
    544
    Well I can't really take your files/package since you bought it from AssetStore, it's not fair to the vendor.
     
  5. zhoy

    zhoy

    Joined:
    Mar 24, 2015
    Posts:
    10
    Hi.proandrius.I upload my Editor Package here.I Simplyfied The Code .I don't know what's problem. UnityEditor's Bug?This Editor Bug? I am not sure.

    Do it Like this.

    1、Create a Test Project.using the default empty scene is ok.
    2、Import iTS.unitypackage(uploaded file by me) into Project.
    3、Drag The "Assets\iTS\Prefabs\iTSManager.prefab" into currrent empty Scene.
    4、Keep the iTSManager node in hierachy Selected。Click some Button in Inspector panel。You'll find It is fine.No problem.
    5、Toggle The "Settings Button". First Press"Reprocess lane points " then Press "Reprocess connectors points" button.

    6、wait a while.Click any button in this inspector. The unity Editor Response very very slow now!

    7、But wait a long time .The Editor come to nomal.But if you click any button. It need to wait also a longtime to do sth.

    8、When I Trace and Debug the Code after click.All the function returned immediately.but after returned.The Unity Editor Get blocked.

    I don't know why/ Help me proandrius. Point me what's problem:(
     

    Attached Files:

  6. zhoy

    zhoy

    Joined:
    Mar 24, 2015
    Posts:
    10
    Reprocess lane points " rebuild the lane structure by current new settings ( new resolution) .then it will use old lane 's start_point,end_point.and middle interpolate key points which is used by spline math algorithm.to genertate more step points by resolution.

    Same with "Reprocess connectors points" except it is the connector bettwen two lanes.
     
  7. zhoy

    zhoy

    Joined:
    Mar 24, 2015
    Posts:
    10
    I just want to know why it cause unity Slow.Just give me some tips to solve it. This Asset works well.Every process returned normaly .But why Unity Process is Blocked under some condition.

    It is not render reason. becase event remove the OnSceneGUI. it is still blocked for a long time.

    I switched to unity 5.0/ still have this problem.

    Data memory is too big? it is not so big.

    Help .Help.Thank you very much!
     
  8. zhoy

    zhoy

    Joined:
    Mar 24, 2015
    Posts:
    10
    And do u know if it is worth to develop unity plugin to put it on Asset Store.

    I have developed a road maker engine. It is Better than EasyRoad and others. but i found they didn't put the next new version onto unity's Asset Store. anymore.

    later i will upgrade it to be a city engine for unity ,unity users can use it as a Leve Editor for Games based on our real city .
    something like your great ProTile Map Editor.
     
  9. zhoy

    zhoy

    Joined:
    Mar 24, 2015
    Posts:
    10
    But When I Click Play button .Make the Game to be running.Then bring the scene tab To be forground .Then click any button on inspector .there's no problem. ! So weird problem!
     
  10. zhoy

    zhoy

    Joined:
    Mar 24, 2015
    Posts:
    10
    OK ! I have solved the problem.I think it is a bug of unity .
    I Avoid this bug by using a trick!

    The problem is :
    If My Script derived from MonoBehaviour has a long array (For example "public TSLaneInfo[] lanes;") to serialize。Then Unity will response too slow!
    My trick is:
    Declare a same array in the Editor Script related with that script(derived from MonoBehaviour)
    public TSLaneInfo [] temp_lanes;
    int the end of function "void OnInspectorGUI()"
    I add

    if (GUI.changed)
    {
    manager.lanes = null;/*new add*/
    EditorUtility.SetDirty(manager);
    }
    Then in the function of "OnSceneGUI()" I Add some code like below:

    if (manager.lanes == null && temp_lanes != null)
    {
    manager.lanes = temp_lanes;
    }

    Then there's no problem now! All click response quickly!

    Is it a bug of UnityEditor??

    Thank you all the same proandrius.
     
  11. zhoy

    zhoy

    Joined:
    Mar 24, 2015
    Posts:
    10
    IF unity think it's not fair to the asset vendor. you can delete this topic!
    If Unity think it is unity's Bug.you can tell us it actually is and fix it later.