Search Unity

Blank UnityEngine.TextAsset

Discussion in 'General Discussion' started by USDev, Apr 28, 2017.

  1. USDev

    USDev

    Joined:
    Dec 5, 2016
    Posts:
    6
    Hi,

    I was printing out everything that's existing after a transition to an empty scene after loading a full map in Unity 5.4.5.

    The thing is that after each transition to the empty scene, from a full map, there is 200 more UnityEngine.TextAsset laying around and they all have no name, no data and the instance ids in the negative range.

    I've looked around the data we use and I can't figure out where it's coming from. Does anyone have any idea?
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    How are you finding these objects?
     
  3. USDev

    USDev

    Joined:
    Dec 5, 2016
    Posts:
    6
    I'm using Resources.FindObjectsOfTypeAll(typeof(T))
    where T in this case is UnityEngine.TextAsset
     
  4. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,537
    This returns objects in the Project, not the Scene. Is that your intention?
     
  5. QFSW

    QFSW

    Joined:
    Mar 24, 2015
    Posts:
    2,906
    Also unrelated note but is there not a template version of the function? Should be faster than typeof(T) and mitigates the need for the cast

    Excuse my derailing
     
  6. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
    I'd use Unity's Memory Profiler to take a snapshot while the game is in that empty scene and then inspect that snapshot to see what is holding a reference to those TextAsset's.

    https://bitbucket.org/Unity-Technologies/memoryprofiler