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

Incorrectly unloaded MonoBehaviour class

Discussion in 'Windows' started by juliancruz, Jan 17, 2014.

  1. juliancruz

    juliancruz

    Joined:
    Feb 18, 2013
    Posts:
    25
    I have this alert when I build my game in windows phone.

    Incorrectly unloaded MonoBehaviour class 'BootsItem' in prefab 'Boots' during GarbageCollectUnusedAssets.
    The Object will be reloaded from disk, to fix this properly keep a reference to the MonoBehaviour directly instead of the game object or other component.

    (Filename: C:/BuildAgent/work/d3d49558e4d408f4/PlatformDependent/WinRT/GarbageCollectSharedAssetsWinRT.cpp Line: 658)
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,627
  3. sigmadruid

    sigmadruid

    Joined:
    Dec 28, 2013
    Posts:
    21
    Hello, I'm facing the same problem, too.
    Because there are so many identical reports(seems every class derived from MonoBehaviour), I can't add this sentence to all of them. Besides, if I do so, will I get out of memory? Is there any other alternative solution?
     
  4. juliancruz

    juliancruz

    Joined:
    Feb 18, 2013
    Posts:
    25
    I need to destroy these objects because the other scene doesn't need them, can I do something to solve it?
     
  5. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,627
    You can explicitly call Destroy() method on an object.
     
  6. juliancruz

    juliancruz

    Joined:
    Feb 18, 2013
    Posts:
    25
    it's was not happening on unity 4.3.2, but now in Unity 4.3.3 is going on always, and this is bothersome, because doing very slow the transition between scenes and feels unusual, there is no way the prevent it log shows this message. Without specify to all objects that will destroy with method Destroy?

    Thanks
     
  7. ShashankDixit

    ShashankDixit

    Joined:
    Jan 7, 2014
    Posts:
    41
    I remember facing the same issue...so what I did was to remove static prefabs assigned from Inspector and instead created
    them dynamically in script and then this error stopped.
     
  8. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    279
    "Incorrectly unloaded MonoBehaviour class 'UISprite' in prefab 'Chapter' during GarbageCollectUnusedAssets.
    The Object will be reloaded from disk, to fix this properly keep a reference to the MonoBehaviour directly instead of the game object or other component."

    i keep getting above error after switching to new scene where i am not using Chapter Prefab and its related texture atlas at all. I I dont want any kind of reference to that atlas in game scene because its a huge atlas and consuming. How to tackle this issue. I tried destroying the object, setting the variable to null still i am getting this error.
     
  9. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,658
    Ignore this message for now... It will be fixed in 4.5
     
  10. bptak

    bptak

    Joined:
    Dec 10, 2012
    Posts:
    2
    Hi,

    Could you explain what the problem was and how it was fixed?
    I'm stuck on 4.3.4 just now and getting this a lot. It looks to me like it's caused by objects not being garbage collected that should be - as other people have mentioned the things that the warnings are for are objects that we're not explicitly holding onto ourselves so should be cleared away when we change scene.

    I believe that in our case it's actually affecting the game negatively (rather than being just an annoyance) - we're seeing UI atlases not being cleared away and then when returning to the original scene they are often missing their texture (which presumably has been cleared) causing UI to not render. I'm currently debugging the garbage collector code trying to track down why these objects are persisting but it's slow work.

    Thanks,
    Barry.
     
  11. bptak

    bptak

    Joined:
    Dec 10, 2012
    Posts:
    2
    Never mind. I've looked at the source...