slumtrimpet
slumtrimpet

Reputation: 3267

Unity3D UGUI Canvas Gizmo

Is it possible to draw Gizmos (https://docs.unity3d.com/ScriptReference/Gizmos.html) in the scene view.. but overlaying the UGUI Canvas (within the scene view) and not particularly in world space? I'm looking to outline some UI elements in the scene view more fully than the vanilla Unity RectTransform is shown there.

We looked at using https://docs.unity3d.com/ScriptReference/Gizmos.DrawGUITexture.html but that appears to fall-back on old-style UI layout and doesn't account for the multiple different Render Modes the UI Canvas can be set to.

Upvotes: 0

Views: 1971

Answers (1)

zwcloud
zwcloud

Reputation: 4889

No.

You need to create the gizmos yourself in the game. There are some plugins in the asset store that provide re-implemented gizmos. You can have a look at them.

To show a 3D object in a texture, you need another camera and a RenderTexture asset. Let the camera look at the gizmos you created and assign the RenderTexture to Camera.targetTexture.

To show the texture on the UGUI Canvas, create a RawImage, then assign the RenderTexture to it.

Upvotes: 2

Related Questions