Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Mystery Square

Discussion in 'Editor & General Support' started by JaimeGranel, Mar 7, 2023.

  1. JaimeGranel

    JaimeGranel

    Joined:
    Nov 6, 2020
    Posts:
    22
    Hi, I'm currently working on Unity version 2021.3.6 and I've come across a square in my scene that is only visible from one side, cannot be selected, and persists even when all objects in the scene are deactivated. It doesn't show up in the camera view, but affects raycasts and follows the player object in front of the camera. I'm not sure if this is an error in Unity or if there is an issue with the code implementation. The project has gone through several hands and I can't seem to find the source of the problem. If anyone has any ideas about this mysterious square, I would appreciate the help
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,606
    Probably best to post an image.
     
  3. JaimeGranel

    JaimeGranel

    Joined:
    Nov 6, 2020
    Posts:
    22

    This square can only be seen from one side and follows the vehicle, it cannot be selected. It has nothing to do with the shader I created, I already tried deactivating it and it's still there. If I deactivate all the objects in the scene, the square is still visible
     
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    does Frame Debugger see it? *ah its scene only, so probably doesnt help
     
  5. JaimeGranel

    JaimeGranel

    Joined:
    Nov 6, 2020
    Posts:
    22
    I checked it but I don't get anything strange there
     
  6. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
  7. JaimeGranel

    JaimeGranel

    Joined:
    Nov 6, 2020
    Posts:
    22
    It doesn't seem to be the case, because there the square is visible on the camera. Instead, in my case, it is only visible in the editor scene window and also blocks a raycast that I cast. Thanks anyway, and if you think of anything else, I would appreciate it
     
  8. John_Leorid

    John_Leorid

    Joined:
    Nov 5, 2012
    Posts:
    646
    Have you tried this:

    https://gist.github.com/FlaShG/38d860c836d9e09d606def9e6069024a

    ?

    It might be an Object that is hidden in the hierarchy, so you can't deactivate it. Maybe that's also the reason why you can't select it. I would alter the script so it also prints them to the console, so you can search for the name of the previously hidden objects.

    It could also be a Gizmo (or Handles-Object) or an Object drawn with Graphics.DrawMesh, if that's the case (which is actually even more likely than it being a hidden object) you have to search the codebase.

    Suggestion: As there are multiple overloads for those methods, either find all references (Shift + F12 in VisualStudio) to the base class ("Graphics" or "Gizmos" or "Handles") or use the text-search (CTRL + Shift + F in VisualStudio).

    Edit: It might also be possible to draw such a plane with the GL class, if it's none of the others, maybe search for that one too.
     
    JaimeGranel likes this.
  9. JaimeGranel

    JaimeGranel

    Joined:
    Nov 6, 2020
    Posts:
    22
    It's not completely solved, but you've helped me make progress. It was a plugin that used Graphics.DrawMesh (the plugin is ZED), but I'm still experiencing some blocking, possibly caused by the same plugin. There must be something else out there. Anyway, thank you. You've helped me advance a bit. If you think of any other class that might be causing collisions, it would help me
     
  10. John_Leorid

    John_Leorid

    Joined:
    Nov 5, 2012
    Posts:
    646
    You could check the type of collision, if it is a collider or a mesh/gizmo/gizmo-icon/handle. Maybe by using the physics debugger (it should draw all colliders) or by placing an empty into the scene and dragging it while holding CTRL+Shift+LMB. If it collides (or shows up in the physics debugger) it's an actual collider - but I doubt that.

    You should be able to debug log collisions by using the same scene picking as unity.
    And while looking it up I just discovered that there are ways to override it ->
    HandleUtility.pickGameObjectCustomPasses

    HandleUtility.PickGameObjectCallback


    So after trying to log it, you might want to search for the HandleUtility class. ^^
     
    JaimeGranel likes this.