Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Is it possible that some managed objects get attributed to the wrong gameobject?

Discussion in 'Profiler Previews' started by trooper, Mar 9, 2019.

  1. trooper

    trooper

    Joined:
    Aug 21, 2009
    Posts:
    748
    I've had trying to find out where some Int32[] and Vector3[] arrays are being created. (7.9mb and 4.6mb)

    They all linked to a set of gameobjects all named the same and were instanced prefabs. I deleted all of them from the scene (as I was sure they had lots of cached data we weren't using atm) and re-ran the profile (on iOS device) and the memory remained the same but moved over to a new gameobject.

    Before:
    upload_2019-3-9_21-22-49.png
    upload_2019-3-9_21-24-59.png
    After:

    upload_2019-3-9_21-24-18.png
    upload_2019-3-9_21-24-39.png
     

    Attached Files:

  2. trooper

    trooper

    Joined:
    Aug 21, 2009
    Posts:
    748
    Maybe it's just taking the first object it finds to attribute it to?

    All these strings are definitely not related to this game object at all.
     

    Attached Files:

  3. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,452
    Hello,
    This might be a bug or at least a bit of a weird understanding of relatedness on the part of the MemoryProfiler.

    Can you please check if there is any chain of references that leads from one of these arrays to the GameObject that supposedly owns it? I.e. go through the items in you see when clicking on the Ref Count number for one of these arrays, and then recursively through all the references to these references and so forth?
     
  4. trooper

    trooper

    Joined:
    Aug 21, 2009
    Posts:
    748
    The objects it was attributing the arrays to was actually an inactive object that we didn't need in the scene so I removed them all and when I profiler again it moved it to another random object.

    I can't find any reference to this array except for what's inside the Mud script. I've since changed the int[] to ushort[] because my intention was to save memory but the attribution to a random object still exists.

    You can see below nothing actually links to it. The mud script is attached to an object in the scene and is never accessed by anything and the prefab that contains the game object Dest_Car_Dashboard_LOD1 has no scripts attached to it.
    upload_2019-3-12_9-35-39.png
    2019-03-12_09-31-30.gif
    2019-03-12_09-40-36.gif
     
  5. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,452
    Is there any relation between the MeshCollider on the Mud Object and the Car Object? E.g. are they colliding while you take the snapshot? do they somehow share the mesh or a material?
     
  6. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
  7. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,452
    Yes this was my first assumption as well but we've found an issue in the crawler where we parse the association to native objects. If this issue is originating from that faulty code, this should be fixed in the next package update :)
     
  8. dotsquid

    dotsquid

    Joined:
    Aug 11, 2016
    Posts:
    224
    It seems the bug survived. I'm using the latest version 0.1.0-preview-6 and it seems shows weird relations between objects. In the attached gif you may see that enormous number of objects are related to a 'Headlight' object which in fact is a simple GameObject with a SpriteRenderer on it.
     

    Attached Files: