TanukiDigital Posted July 24, 2025 Posted July 24, 2025 (edited) In Unigine ver 2.20, using Texture.Load() inside an UpdateAsyncThread() function will inevitably hang the the engine and then crash to desktop. Sometimes it will load once or twice without issue but usually there is a hard hang as soon as the code is run even once. The code works fine in ver 2.19.1. The code works fine when used in Update() and UpdateSyncThread(). Below is example C# code... [ParameterAsset (Filter = ".texture")] public AssetLink testTexture; void UpdateAsyncThread(){ if (testTexture != null){ Texture newTexture = new Texture(); if ( newTexture.Load(testTexture.Path, 0) ){ Log.Message("Texture Loaded!\n"); } newTexture = null; } } Edited July 24, 2025 by TanukiDigital
silent Posted July 24, 2025 Posted July 24, 2025 TanukiDigital Crash is kinda expected in that case, because you are interacting with GPU-related objects: https://developer.unigine.com/en/docs/2.20/code/fundamentals/thread_safety/?rlang=cpp&autotranslate=en#gpu_objects Maybe it was working in 2.19 with DX11 only? You can rewrite this code in 2.20 and use special GPU_STREAM thread: AsyncQueue.RunAsync(AsyncQueue.ASYNC_THREAD.GPU_STREAM, () => { if (testTexture != null) { Texture newTexture = new Texture(); if (newTexture.Load(testTexture.Path, 0)) { Log.Message("Texture Loaded!\n"); } newTexture = null; } }); Please note that you can only load resources in this thread. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
TanukiDigital Posted July 25, 2025 Author Posted July 25, 2025 Thank you for the code and explanation, it's much appreciated. And yes using AsyncQueue.ASYNC_THREAD is working well.
Recommended Posts