Search Unity

Invalid AABB errors

Discussion in 'Scripting' started by Nanako, Jul 29, 2015.

  1. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    Most of the time (not every time) when i exit play mode in my current project, i get 64 errors.


    That is, 16 instances each of the following:
    Code (CSharp):
    1. Converting invalid MinMaxAABB
    2. UnityEditor.DockArea:OnGUI()
    Code (CSharp):
    1. localAABB.IsFinite()
    2. UnityEditor.DockArea:OnGUI()
    Code (CSharp):
    1. Invalid AABB aabb
    2. UnityEditor.DockArea:OnGUI()
    Code (CSharp):
    1. Invalid AABB result
    2. UnityEditor.DockArea:OnGUI()
    Those are the entireity of the error text.

    I don't know what this error means, i don't even know where or how to begin debugging it. Attempting to doubleclick the errors in the console does nothing. They don't give me any information about what could be causing it.

    I've attempted to google it and search for results. But the only people with similar errors, seemed to be having their problems with particle systems. I don't have any particles in this project, never used them.

    I need some guidance here. This has been around for two months and im having no luck fixing it. It doesn't seem to affect anything except my patience, but i'm finding it infuriating
     
    FreeJoyCQ likes this.
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    what custom editor scripts are you running?


    sounds a lot like something isn't having time to sort itself out when it starts being used and it's bounds are 0 or infinity, given that it's an error in the editor ongui I'd start checking there.
     
    Last edited: Jul 29, 2015
  3. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    Offhand, the only thing i can think of is my interactiveObject scri[pt which runs in edit mode. i've tried disabling all instances of objects which use it, and that doesn't seem to have solved anything.

    I don't believe i'm using any kind of plugins or editor extensions in this project. But is there any way to be sure?
     
  4. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    Ok i've found the source of the problem. or at least narrowed it down.

    I have all my UI objects under one main umbrella canvas (it has lots of smaller subcanvases on it)

    The main canvas itself seems to trigger the issue. disabling and reenabling it fires those errors. Disabling and reenabling any/all of its children, does not.

    Here's how the main canvas looks in inspector:



    Is there anything there that might be causing my issue?
     
  5. DonLoquacious

    DonLoquacious

    Joined:
    Feb 24, 2013
    Posts:
    1,655
    Nothing that I see there, that's all completely generic canvas stuff and looks fine, but you're making a faulty assumption.

    Disabling the parent actually COULD cause a problem in a child (or a script attached to a child) when disabling the child itself does not, provided that there's some script that relies on the "activeSelf" instead of "activeInHierarchy" of one of your GUI objects to tell whether or not to try and access / how to access the scripts attached to them. "activeSelf" will return false only if the object itself is disabled directly, while "activeInHierarchy" will return false if it's not active either because it's been disabled directly or because a parent/grandparent is disabled.
     
  6. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,491
    I get exactly the same set of errors if I've got a corrupted .blend file and have the animation preview window open.

    The error messages are the kind generated by assertions - seems like there's an IsFinite() assertion in the UnityEditor.DockArea:OnGUI() method. So there's probably something in your scene (or one of your inspectors) which has a 0-size bounding box, which seems to cause a divide by zero, which fails the assertion and causes the error spam. That's by best guess.
     
  7. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    Ok i went looking through the hierarchy, and i was able to find one subcanvas which had its width and height set to 0.
    I changed them to something small, 30 i think.

    Now the errors i get from disabling and re-enabling the canvas, have changed


    that's all just from disabling and re-enabling the main canvas once.

    In addition to that, and almost certainly related, disabling and reenabling also causes two of my UI elements to be moved to incorrect positions.

    For reference, here's how it normally looks (game view)



    And here's what happens after D/E the main canvas:



    Here's the UI hierarchy for reference




    The tall slider is the zoombar.
    The box with buttons and text in it is the StatsPanelCanvas (it's normally shrunk to 0.01 scale and hidden under the Stats button in the upper right, it shouldn't be visible outside of play mode)

    Both of these main things are direct children of the main canvas.

    These new positions are NOT reflected in the inspector, none of the inspector values change. but they are visible in game view, and also in scene view if i enable viewing the UI layer

    Entering and then quitting play mode causes them to snap back to their proper positions

    The mystery deepens, i need some help here :(
     
  8. deab

    deab

    Joined:
    Aug 11, 2013
    Posts:
    83
    I found this thread as I was also suddenly seeing the AABB errors when ending play mode. After much messing around I found an item with the rect transform scale set to 0,0,0. Fixing this removed the errors.
     
    twobob likes this.
  9. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    i don't think it's anything related to blends, i never import them, and no meshes at all are involved in this issue. i'm confident it's caused by something in my UI
     
  10. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    bump, ! this issue is kind of critical right now, especially since its worsened, see post #7 above
     
  11. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    Ok then, it's time for the next step in debugging technology!

    Here is a scene: https://drive.google.com/file/d/0B0aQOsW6nXKgNUVzakREMXhKMnc/view?usp=drivesdk

    Click that link and then the Download button at the top of the screen.
    I've isolated the problem down to the bare minimum. You can open this scene in any project, it uses mostly default assets. Although it might throw errors if you try to actually run it. Going into play mode is not necessary.

    To reproduce the problem, open the scene, go to Scene View (this is important, doesnt seem to happen in game view), clear the error console,

    And then toggle the enabled flag on the toplevel "Canvas" object, off and back on.

    It will output about 65 errors into the console
    If you disable some of its children (and its children's children), and then do the toggling again, the number of errors is reduced proportional to the number of objects you disabled. As far as i can tell there's about four errors for each child.

    Can someone please look at this and figure out what's going wrong ;-;
     
  12. DonLoquacious

    DonLoquacious

    Joined:
    Feb 24, 2013
    Posts:
    1,655
    Try turning off "override sorting" on sub-canvasses. And yes, I am awesome.
     
    Last edited: Aug 3, 2015
    twobob and Nanako like this.
  13. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    well now, interesting, that DOES fix it. But why? Why does override sorting cause a problem to begin with?

    I originally turned that on though, for two reasons In my original UI,

    1. the statspanel folds away to underneath the stats button. I had to edit the sort order to make sure it stayed under, and not ontop. It seemed to keep popping back ontop when it was moved
    2. I have a "dimmer" screen object which is a partially transparent black panel used to cover the screen, i activate that when the window loses focus. To indicate to me and the player, that the window is out of focus, and also to prevent clicks registering until its focused again. I used sort order to make this draw ontop of every other UI element.

    Any idea how i can achieve these these results without overriding the sorting?

    Also turning off override sorting on my subcanvases causes their content to be invisible. I can fix this by removing the Canvas component from them, and everything that depends on it. That sorts it, but it's also no longer a canvas

    I was under the impression that a canvas was the general "thing you put other things on" and that i should be using lots of them to group together buttons. If that's not the case, then what are subcanvases even for? am i using them wrong? They don't seem to work very well
     
    Last edited: Aug 3, 2015
  14. DeftMunky

    DeftMunky

    Joined:
    Feb 12, 2014
    Posts:
    1
    I am seeing a similar issue when we're changing the .text value of a text control.
     
  15. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    try disabling OverrideSorting on any canvases, and check for UI elements with a width or height of 0 (or negative)
     
  16. ExNinja

    ExNinja

    Joined:
    Dec 4, 2013
    Posts:
    9
    I've also encountered the "Invalid AABB aabb" issue, and none of these fixes have helped yet. I wrote the following code to search for scales that were somehow set to 0, but none have appeared. Possibly this code would be helpful to someone else though.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.UI;
    4. using System.Collections.Generic;
    5.  
    6. // This should only be used for debugging the "Invalid AABB aabb" error - JB
    7.  
    8. public class CanvasAABBInvestigator : MonoBehaviour {
    9.  
    10.     public bool                        delve = false;
    11.  
    12.     public List<RectTransform>        rts;
    13.  
    14.     // Use this for initialization
    15.     void Start () {
    16.         if (!delve) return;
    17.  
    18.         rts = new List<RectTransform>();
    19.  
    20.         RectTransform rt = GetComponent<RectTransform>();
    21.         Delve(rt);
    22.     }
    23.  
    24.     void Delve(RectTransform rt) {
    25.         if (rts.IndexOf(rt) != -1) return;
    26.  
    27.         rts.Add(rt);
    28.         RectTransform[] tempRTs = rt.GetComponentsInChildren<RectTransform>();
    29.         foreach (RectTransform rtT in tempRTs) {
    30.             Delve(rtT);
    31.         }
    32.     }
    33.  
    34.     void Update() {
    35.         if (!delve) return;
    36.  
    37.         // Search for any scale that is 0
    38.         Vector3 scale;
    39.         foreach (RectTransform rt in rts) {
    40.             scale = rt.localScale;
    41.             if (scale.x == 0 || scale.y == 0 || scale.z == 0) {
    42. //                Utils.Print("CanvasAABBInvestigator", "RectTransform scale of 0", rt.gameObject.name, scale);
    43.                 Debug.LogError(System.String.Format("{0}\t{1}\t{2}\t{3}", "CanvasAABBInvestigator", "RectTransform scale of 0", rt.gameObject.name, scale));
    44.             }
    45.         }
    46.     }
    47.  
    48. }
    49.  
     
    twobob likes this.
  17. ExNinja

    ExNinja

    Joined:
    Dec 4, 2013
    Posts:
    9
    After more research and testing, it seems like my Invalid AABB error may have been caused by a corrupted scene file. To fix the issue, I cloned an older version of my GIT repo (from before the error appeared) into another folder. None of the code changes since that version seemed like they could account for the error, so I tried copying the main Scene file from that safe version into my new version that was experiencing the AABB errors. When I loaded the old (safe) scene in the new (broken) Unity project, everything worked absolutely fine!

    So, if you encounter this error and are using version control, I recommend trying to pull a scene from a previous version of your project and see if that doesn't fix it. As far as I know, I didn't make any scene changes between the non-broken and broken versions; it just stopped working or got corrupted or something.
     
  18. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    469
    I'm encountering the same issue. However, going back to a previous scene file is out of question for this project. Could you do a diff on the scene files? Maybe that somehow shows where the problem came from...
     
  19. HeywoodFloyd

    HeywoodFloyd

    Joined:
    May 27, 2009
    Posts:
    16
    I encountered the bounding box error when I was manipulating the vertices of a mesh through code, and sometimes set y values to Mathf.NegativeInfinity (seemed like a good idea at the time.). Setting them to a valid floating point number made the problem go away.
     
  20. jankymidget

    jankymidget

    Joined:
    Jul 26, 2015
    Posts:
    7
    I'm seeing these AABB related errors. Except I have almost no idea what the cause is. I'm pretty sure it was nothing I did. My hard drive crashed and all I had was the code in my Git Repo and when I cloned it a lot of stuff was jacked up. I restored model asset meta data and had to reanimate one of the characters, but I suddenly noticed these aabb errors. Also suddenly if you load a scene everything goes very dim.
     
  21. Dan-MacDonald

    Dan-MacDonald

    Joined:
    Oct 25, 2013
    Posts:
    13
    I'm getting these increasingly as my project ages, I do use mecanim to drive UI animations. I get some 240 of these every time the scene loads or the application stops playing in the editor.
     
  22. kobyle

    kobyle

    Joined:
    Feb 23, 2015
    Posts:
    90
    Same problem here, if I disable "Override Sorting" the errors dissapear, any fix on this issue?
     
  23. bricevdm_flare

    bricevdm_flare

    Joined:
    Sep 30, 2015
    Posts:
    1
    I've been looking into this too when it randomly appeared in a place that had no issues before:

    it happens when I set the position of a rectTransform and if BOTH 'Scene' and 'Game' views are visible.

    This is totally an editor bug imho, but having game and scene in tabs solves the issue. too bad for your convenient work layout.
     
  24. TimKofoed

    TimKofoed

    Joined:
    Aug 9, 2012
    Posts:
    6
    I just encountered this issue, and in my case the error is triggered if I have an "override sorting" checked in an element which is a child of something else which also has "override sorting" triggered.

    As soon as I remove the bool "override sorting" of the child, but keep its parent's "override sorting", the errors go away.
     
  25. Gizmoi

    Gizmoi

    Joined:
    Jan 9, 2013
    Posts:
    327
    I am also getting this issue.
    I don't have Scene and Game Views visible at once.
    I have a hierarchy like so:

    Code (CSharp):
    1. Canvas ->
    2.     <...UI...> ->
    3.         Canvas ->
    4.             <...UI...>
    5.     <...UI...>
    6.     Canvas ->
    7.         <...UI...>
    Where the top canvas is Screen Space - Camera, default sorting layer, and has a Canvas Scaler.
    The two child canvasses are inherit Pixel Perfect (which is off in the parent) and override sorting.
    Ideally I don't want to override sorting, but if I don't, the child canvasses flicker behind the parent canvas when moved around.
     
  26. games4ever

    games4ever

    Joined:
    Jan 23, 2014
    Posts:
    10
    In my case, the problem was that a Particle system (that was child of a UI Sprite with a RecTransform), had a negative transform rotation in 'x' of -90. Changing all rotations (xyz) to cero by default, solved the issue. (unity r.5.3.1).
     
  27. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    For me it happens with a particle system that has no active particles. I can have a system that when it has none spawned, it'll throw about 30 errors per system, but increasing particle lifespan/emission rate makes it go away, but comes back when those particles die. Not the first time I've seen the AABB errors, lots of stuff can cause it sadly, really wish I could turn them off.
     
  28. melkior

    melkior

    Joined:
    Jul 20, 2013
    Posts:
    195
    I am having similar problems; just upgraded to 5.3.1f and got a ton of these errors on my project that previously worked without errors.

    Haven't tried applying any of the suggested work arounds yet .. been sick for the past week and this was not a pleasant "im starting to feel better I should work on my project" present!

    edit: Fixed by reverting to Unity 5.3.0
     
    Last edited: Dec 30, 2015
    mbkm and neodorus like this.
  29. Eitrius

    Eitrius

    Joined:
    Dec 30, 2013
    Posts:
    19
    There is actually a patch that fixes this (at least it did for me). Check in patch releases, it is 5.3.1p1
     
  30. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,255
    I can confirm that patch fixes the problem when it's caused by particle systems that have no active particles (usually world space emit by distance particle systems).
     
    HellsPlumber likes this.
  31. Lionious

    Lionious

    Joined:
    Apr 19, 2013
    Posts:
    22
    Im running 5.3.1f1 and get the same error for AAB error the try to do everything but nothing work .
     

    Attached Files:

  32. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,255
    LVBen and karl_jones like this.
  33. Lionious

    Lionious

    Joined:
    Apr 19, 2013
    Posts:
    22
    ty yea i download it Yesterday now new problem show on Reflection probes is work fine with editor but not the player . by add new gameobject that been using InstantiateSceneObject when i use that , the gameobject look so much darker , like im not even using Reflection , that only happen on player mode but not the editor
     
  34. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    3,687
    Hey if you found a new problem best to report it using the bug reporter. Ta
     
  35. HCrowley

    HCrowley

    Joined:
    Oct 16, 2013
    Posts:
    18
    I just started getting these (to be honest pretty unhelpful) AABB messages when I upgraded to 5.3

    For me it seemed to be related to Canvas Sorting, and patch 5.3.1p1 fixed it (although I've had to set both of my Canvases to Sort Order = 0, because otherwise the Canvas which previously had the higher Sort Order was no longer interactable)
     
    LVBen likes this.
  36. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    3,687
    Can you file a bug report with an example project please?
     
  37. gouthammannuru

    gouthammannuru

    Joined:
    Sep 9, 2015
    Posts:
    16
    Even i have the same error but i could even build the project without any problem , i started getting this error after using UNITY standard asset particle system (fire explict)
     
  38. CodeAssembler

    CodeAssembler

    Joined:
    Oct 15, 2011
    Posts:
    33
    Hi all, don't know if this could be of help but in my case I did not had the errors neither until I upgraded to the most recent Unity version 5.3.1f1 - the issue I found is that I was scripting a Particle System and I left it 'enabled' but with the 'Max Particles' field equal to zero.

    Apparently the previous Unity versions wouldn't really mind this much neither at editor simulation mode or real time. Now with the upgrade I found this field has to be at least equal to 1. Otherwise the particle system fails the computations and produce this errors (like its trying to divide by zero I guess).

    So my fix was easy, just updated the scripts with works around so this field never gets to zero anymore. Hope it helps.
     
  39. buckius82

    buckius82

    Joined:
    Nov 19, 2013
    Posts:
    38
    i had a similar issue with the line render er it was the check in the use light tat was causing it. i unchecked it and it was good
     
  40. Ismoh

    Ismoh

    Joined:
    May 3, 2016
    Posts:
    2
    I had the same issue and unfortunally all your ideas didnt helped, because of that i tried to figure out whats going on:

    There are UI elements with mask, etc - Healthpoints Bar.

    My Script calculated the current size of the image, which depends on the current hp.

    At that moment the character died - cause of 0hp -, the calculation returns float.NaN, because there was a division by zero during the scene reload.

    I guess every AABB in AABB Error tells you, that some value of your UI is float.NaN, which cant be displayed. This isnt rly a good result to inform the unity-user.

    so i did the following:
    Code (CSharp):
    1. float x = imgSize / hpMax * hpCurrent;
    2. if(float.isNaN(x)) x = 0;
    maybe my calculation isnt the best, but it works fine.

    I am using Unity 5.3.4p5.
     
  41. yuchting

    yuchting

    Joined:
    Aug 12, 2012
    Posts:
    12
    I found a reason about strange error out put text (in Unity 5.1.4):

    I'm sure it is a unity engine bug.

    Code (CSharp):
    1.  
    2.     RectTransform t_parent = ...;
    3.  
    4.      for(int i = 0;i < 80;i++){
    5.       // loop at many times, to reach a limit, in my project, it is 80
    6.       // it will be neat the capacity of Canvas
    7.        PrefabHasText hasAText = Instantiate<PrefabHasText>(Prefab);
    8.  
    9.        hasAText.transfrom.SetParent(t_parent,false);
    10.  
    11.        hasAText.Text.text = "1111<color=#fffffff>" + sometext + "</color>"; // a text for color tag
    12.      }
    13.  
    When I set:

    Code (CSharp):
    1. t_parent.gameObject.SetActive(false);
    I will get the error code:

     
  42. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    3,687
    Did you file a bug report?
     
    Last edited: Jul 21, 2016
  43. BoaNeo

    BoaNeo

    Joined:
    Feb 21, 2013
    Posts:
    36
    Here's one more thing that can cause this error (and which I have not seen mentioned elsewhere): Very small sprites. I had a transparent 1x1 pixel sprite that was used in places where an Image was needed, but should not be visible. Changed it to 8x8 and the AABB crap went away.
     
  44. CodePhantom

    CodePhantom

    Joined:
    Jul 20, 2016
    Posts:
    1
    Another thing that causes that error is if you modify a Terrain through script and set the size to be 0 for the width, length, or height.
     
  45. RomanLov

    RomanLov

    Joined:
    May 5, 2013
    Posts:
    4
    got this errors (invalid aabb a, Quaternion matrix (nan,nan,nan,nan)) when i modify animation clip (rotation of object). One of keys was damaged (or smth) and z value always was 7.264157e-07 and don't apply changes. Errors appear when camera look on this object. So i create new animation clip, copy/paste all keys and then this key successfully apply value, error is gone
     
  46. TATOME

    TATOME

    Joined:
    Nov 25, 2016
    Posts:
    4
    in my case that !! sorry my enghlish
    if y have animation in project
    check your animation.all frame game object animator need to be using all or not breaked.
    if y have frames is 30
    example:: walk frame 0-10;laught 11-30 is good and walk 2-10,laught 11-30 is good too.
    but walk 0-10;laugth 12-30.i guess unity get bug for frame 11.
    you can set a animatior phase and don't call it if you don't like.something like that
    good look !!
     
    Last edited: Dec 27, 2016
  47. Goaf

    Goaf

    Joined:
    Dec 29, 2017
    Posts:
    2
    Hey, got similar errors. I found that the problem was coming from the fact that I had put some objects inside other objects, and then enabled collision detection for them. This happened when I duplicated an object but forgot to move it away, thus keeping its position within another object. When I removed the duplicated objects, the errors were solved.
     
  48. meat5000

    meat5000

    Joined:
    Mar 5, 2013
    Posts:
    118
    An object with 0 Scale will give you a whole plethora of AABB errors. It will basically generate every type of AABB error known to mankind. An imported model with Zero-area face or bad geometry can easily cause this error, or a Ghost object that got imported with that rest that didnt have its Transform data included.
     
    Munchy2007 likes this.
  49. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    3,687
    That sounds like it's worth a bug report. ;)
     
  50. meat5000

    meat5000

    Joined:
    Mar 5, 2013
    Posts:
    118
    I know, right? Whats going on in the world! :D I just thought I'd throw this in here. Its the simplest cause of the error
     
    karl_jones likes this.
unityunity