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. Dismiss Notice

Texture missing after cross to different scene.

Discussion in 'Windows' started by TwisterK, Nov 16, 2014.

  1. TwisterK

    TwisterK

    Joined:
    Oct 26, 2010
    Posts:
    110
    Anyone encounter a bug where by texture missing after tab out and tab in from window phone? How do I reload the texture back? I'm using Sprite manager 2 by the way.
     
    namine likes this.
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,491
    Hi,

    could we have a bug report to look at? Which Unity version are you on? Unity should automatically reload textures in most cases.
     
  3. TwisterK

    TwisterK

    Joined:
    Oct 26, 2010
    Posts:
    110
    Found the cause of the problem, for some reason, window phone handle private static variable differently. I've cached a prefab in a static variable and instantiate it when back to main menu scene. It works flawlessly in Android and iOS, but when port to Window, when doing the same thing, some of the textures just went missing. Please do note that, I've load texture on demand via Resources.Load function.

    I'm also notice that when tab in and tab out from the windows phone app, it will clear the scene memory's texture ( check via profiler ) which cause me some trouble to re-code to handle such behavior.

    I'll try to send a bug report for it, the project size is huge, i need some time to trim the project size.
     
    namine likes this.
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,491
    This **might** be a known issue. Normally, when Unity loads a new scene, it unloads all assets. In order not to destroy it, we need to know it's still needed. In case of Mono platforms, we have ability to walk through the object graph and see that the managed objects are still alive. However, on .NET we do not have such an ability, so the static variables are not checked. We have a few ideas of how we can fix it in the future, but I can give no promises of when it's going to be implemented.

    If you want to tell Unity not to unload an asset when you load a level, use this method:

    http://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html
     
  5. TwisterK

    TwisterK

    Joined:
    Oct 26, 2010
    Posts:
    110
    Thanks for the insight!