Drawing doesn't start in editor when dragging in prefab

When spawning a prefab with a script of base MonoBehaviorGizmos with this draw code in it doesn’t draw. If I reload the scene it draws as normal.

If I add the script to an already existing object it starts drawing immediately.

If this script is on a child of the root prefab object drawing will start as expected.

public override void DrawGizmos()
    {
        using (Draw.InLocalSpace(transform))
        {
            if (GizmoContext.InSelection(this))
            {
                Draw.SolidBox(Vector3.zero, Vector3.one, Color.blue);
            }
            else
            {
                Draw.WireBox(Vector3.zero, Vector3.one, Color.blue);
            }
        }
    }

Unity 2021.3.4f1, ALIGN 1.5.3, URP 12.1.7

Hi

Thank you for the bug report. Is this in editor mode or in game mode?

Thanks for the response!

It’s happening in editor mode.

Thanks! I found the bug and I have fixed this locally.
The fix will be included in the next update.

That’s great to hear!
Thanks again!

Extremely useful tool.

1 Like

In the interim between updates is there anything I can do on my end to fix this issue?

Hi

I’ve published a new version of ALINE now which includes these fixes. :slight_smile: Sorry for the delay.

1 Like

All good! The update seems to have fixed the issue!

However another bug has popped up. It now draws a ghost object at the prefab origin in the scene.

These ghost objects first appear when the first instance of a prefab that has ALINE drawing is put into the scene and then never disappear. Even after deleting all objects or changing scenes. They only go away after restarting Unity.

The ghost draw stops if I surround my drawing code with this check.

if (gameObject.scene.name != null)
{

}

Perhaps it is drawing the prefab in the assets folder in addition to all the prefab instances.

That’s odd. I explicitly check to make sure that I don’t draw prefab objects.
Which version of Unity and any render pipeline are you using?

Sorry to jump in but I wanted to add I am experiencing this as well. I happen to be using the universal rendering pipeline on unity 2021.3.4f1 and beta 4.3.56 if that helps.

This is what a fresh new scene looks like for me with gizmos on, everything centered around the world origin.

If I adjust the x position of one of my prefabs it does effect what is shown so that seems to confirm the prefabs are being drawn.

Hi

Sorry, that was due to a typo in the latest release. I’ll release a fix soon.
https://forum.arongranberg.com/t/bug-aline-urp-draws-gizmos-for-inactive-gameobjects/13203/3

1 Like