Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Application.UpdateScene when modifying textures...

Discussion in 'Scripting' started by mherbold, Aug 2, 2020.

  1. mherbold

    mherbold

    Joined:
    Jun 4, 2017
    Posts:
    35
    I am dynamically updating some texture maps in my game (FFT transform audio graphs in real time).

    However whenever I do either SetPixels or GetRawTextureData and modify the texture and call Apply, a dialog box pops up in the editor saying "Hold on (busy for X:XX)... Application.UpdateScene".

    And of course since I am modifying the textures every frame, this dialog box never goes away. In fact, I cannot exit play mode. The entire editor is stuck and frozen and I cannot do anything else. I have to end task on Unity. What is going on? How do I stop Unity from doing this? I have another older game where I dynamically generate texture maps, and I don't remember Unity doing this before. Is this something new?

    The textures have been created using scripts (new Texture2D). They are not even in the scene (yet).

    Help.
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,907
    Is this in Unity 2020-something? I keep seeing threads pop up about this kind of thing. Makes me wary to make a project in 2020.
     
    KarlKarl2000 likes this.
  3. mherbold

    mherbold

    Joined:
    Jun 4, 2017
    Posts:
    35
    Yes I am seeing this in 2020.1, but I am not sure if this is specific to 2020.1 or not.
     
  4. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Can you file a bug with code/project that reproduces the issue?
     
  5. mherbold

    mherbold

    Joined:
    Jun 4, 2017
    Posts:
    35
    I already did yesterday. Case 1267999.
     
  6. mherbold

    mherbold

    Joined:
    Jun 4, 2017
    Posts:
    35
    I've narrowed it down... it has nothing to do with specifically modifying the texture maps. It has everything to do with how long the Update() method takes. If it takes longer than a certain amount of time, the Hold on... box pops up. And having the Hold on... box pop up is baaaaad during play mode because if your Update() is slow, the pop up never goes away... and you can never exit play mode. Also, the pop up itself seems to have a severe impact on performance - the game mode view never updates while this pop up is visible. This pop up needs to die. At least during play mode forbid it from popping up.
     
  7. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    You can set the time after which the popup shows up in the preferences (default 3 seconds)

    A bunch of people asked for exact opposite, i.e. "I want to know when something was not-responsive for a while, including in play mode". Some even want it to show up after half a second etc.

    So yeah looks like a single behavior can't please everyone, which is why there's a preference.
     
  8. mherbold

    mherbold

    Joined:
    Jun 4, 2017
    Posts:
    35
    It's not about pleasing everyone - the problem isn't with it popping up. The problem is that if, and when, it pops up, and if your Update() takes too long every frame, you have absolutely no way to exit play mode. The only option is to task kill Unity. That absolutely can't be accepted as normal behavior / design on Unity's part. Oops you accidentally made your Update() take a wee bit too long? MUAHAHAHAHA you are doomed! Task kill Unity and lose all your scene changes since the last save! HAHAHHA! That's what it feels like. There needs to be an "exit play mode" button on the pop up itself if you are in play mode. This is because the pop up is modal and you cannot click on the normal "exit play mode" when the pop up is visible (you used to be able to, regardless of how long your Updates() took prior to the pop up feature).

    Bottom line - prior to the new pop up, if your Updates() took took long you could just click on the exit play mode button and after the current Update() ends, the play mode would exit. With the new pop up - you are screwed.
     
  9. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Good point, will look into it.
     
  10. a19tonguepar

    a19tonguepar

    Joined:
    May 30, 2020
    Posts:
    2
    How is all going? I have the same problem, what should i do? :(
     
  11. hybrid_dragon

    hybrid_dragon

    Joined:
    Aug 30, 2020
    Posts:
    18
    -
     
    Last edited: Jun 28, 2021
  12. 100772

    100772

    Joined:
    Jan 20, 2017
    Posts:
    2
    unity 2020.1.6f1
    27 min... Hold on ((
     

    Attached Files:

    kloogens likes this.
  13. HavanaBanana

    HavanaBanana

    Joined:
    Jul 3, 2017
    Posts:
    4
    Same here.. Unity is busy for over 7mins (Application.Tick). I recognized that Unity is started hanging in Unity 2019.4.12 - without this note-window. Thought Unity 2020 maybe fixed it, but nope. No idea why this was no problem in 2019.4.11. Has it something to do with a package? It's impossible to be productive with this "error".
     
    kloogens likes this.
  14. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    2020.2.1 was getting pretty snappy and fast. Then updated to 2020.2.2 and lots of pop ups are kind of taking a long time.
    Perhaps we could have an application ticker bar that doesn't deny interaction and isn't right in the middle of the screen?
     
  15. caxopog

    caxopog

    Joined:
    Oct 20, 2019
    Posts:
    1
    yes, it's major issue - now if u make, for example, infinite loop or some other superheavy stuff, you just can't exit game mode - the only way is to kill unity.
    You definitely should be able to exit game mode during the "updateScene" process. After that "force stop" you can view your logs and find what stuff makes this.
     
  16. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,645
    This has actually always been the case. If you doubt me, try it in Unity3, Unity4, Unity5, Unity 2017, 2018, 2019, doesn't matter. Make an infinite loop in your code and Unity is doomed. SigTerm is ignored, SigKill is your only option.

    I speculate that what they're TRYING to do with the above warning window is to someday give you a way to regain control of the editor. Perhaps that way isn't finished yet but the dialog is in place.
     
    Wolfram likes this.
  17. dezzell

    dezzell

    Joined:
    Feb 7, 2015
    Posts:
    32
    This has been an issue for me for the last couple years. Project would be working fine, then out of nowhere constant Application.UpdateScene and Tic Hold messages. I deleted the Library folder and still after it came up, constant Hold messages while in Editor and Play Mode. I have over 30 projects on various versions. This started messing up on 2020.3 version, and at one point attempted 2022.1 and really hosed it up. I restored from a backup which worked for awhile and then today, it started the UpdateScene hold constant messages over and over again. I changed the default 3 seconds to 0.1 or 1 or 5, really made no difference, kept hosing up.

    Finally, I just did a backup, upgraded to 2022.2.1f1, and no more hold messages after the update. Thank you Unity for fixing that issue. So far things are working, thou I am getting a lot of RenderTexture.Create failed: colorFormat & depthStencilFormat cannot both be none. So looking into this now. So if you are getting these Application.UnityScene and Tic Hold Messages over and over, either restore from backup, or upgrade to 2022.2 version. May have to suck it up and fix outdated issues, however well worth it to put a stop to those stupid hold messages.
     
  18. dezzell

    dezzell

    Joined:
    Feb 7, 2015
    Posts:
    32
    Well, it seems to be less frequent, however still there. At first all appeared to be running much better, then it started the UpdateScene message again about an hour into making changes. I do find that if I hide the Terrain, the message tends to go away. May be trees causing the issue. Would be nice if Unity worked quicker and did away with this message. Seems like 2017 to 2019 worked better and quicker.
     

    Attached Files:

  19. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
    Visual studio is not interfering? What kind of activity is your coding software doing while unity runs. Are very large pages and many tabs open?
    This can some times happen when switching focus from one window to the other.
     
  20. dezzell

    dezzell

    Joined:
    Feb 7, 2015
    Posts:
    32
    Didn't seem like it made a difference removing all trees. I am thinking the issue is lights. Even thou I had Auto Generate turned off, and other GI lights off, the Editor was still slow and the UpdateScene kept coming up. I turned off all point and spot lights, and I noticed in this version, the GI Processing was always running, every time I scrolled or moved around in Editor, and it says SkyManager reflection probes constantly anytime I shifted the screen, it would come back. I found this article https://docs.unity3d.com/Manual/using-skymanager.html

    Which I set the resolution of the sky to 128, and finally I disabled this Tenkoku DynamicSky I've been using for 8 years, and the SkyManager Processing has gone away, and the Editor is more responsive and no UpdateScene messages now. So if you are experiencing constant Popup Messages and editor seems slow, check lights, SkyManager processing all the time for reflection probs. Process of elimination till you find what is slowing things down.
     
  21. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
    Yeah keeping the scene view as simple as possible aswell switching lighting off I work in higher resolution for the game view pick but do an extremity. Sometimes run at smallest resolution design for quick testing but tests that will take longer i swap out to higher resolution to get the intended game experience.
    Assets packs are a pain aswell. But for other reasons. It is abit of a risk if done too late into the project if you have lost track of what’s been used but disabling all of the packages and discovering which ones are relevant as and when you need them is also good editor practice.
     
  22. dezzell

    dezzell

    Joined:
    Feb 7, 2015
    Posts:
    32
    I often wonder how these huge interactive games are being worked on like Watchdog and Just Cause 3/4. These huge terrains with all sorts of interactive interfaces going on. I have simple small terrains and at times it is ridiculous waiting for scenes to load with very little functions, and still have lag and issues with lights. I haven't had the Update Scene popup messages come back since disabling SkyManager. I do recall all working perfectly, then one day had a ton of errors, closed out and that is when I kept getting the ongoing UpdateScene / tic messages Hold please.. So something got hosed up with the Sky and SkyManager kept running and running the reflection probe updates causing Unity Editor to become totally unusable.

    I am on a high end system with 64 GB memory, and Unity seems to be taking up to 5 GB of memory, and it still seems sluggish while working in editor and Play mode. Would be nice to develop unrestricted. Have everything work perfectly and just develop without having to change resolutions, and disable things to speed up the development process. Maybe in the future.