3D Models on a Canvas
Last updated
Last updated
The suggested process for adding a 3D Model to a UI Canvas is as follows:
Using Unity's dropdown menu, add a RawImage element to your Canvas Panel and size it to whatever size you wish your container to be when showing the 3D Model.
You can add a background texture to the RawImage if you wish (see UI example), but the color seeting in the RawImage must be white to be able to see the Model correctly.
Within a Trigger of your choice, add your canvas to be shown using either a fade in from Canvas group, or slide/rotate in form this Package.
In your Action stream, include the Action Display 3D Model on Canvas. This can be beofre or after the Canvas is displayed.
5. Add the RawImage to the corresponding slot (Canvas RawImage), and the Model to be displayed to the 3D Model slot. This can be a Model from your Scene Hierarchy or a Prefab from you Project Folder.
6. The Canvas Camera that is automatically created requires a single layer to display. You should create a new layer (see the tutorials section on how to do this) and assign this layer to all objects that will be displayed on the Canvas. Then set Image Layer of Model to this layer in the Above Action.
7. As the UI Canvas uses a different Scale, you may need to increase the Size of the Model and the Light Intensity and the Type of Light used. This can be done in run mode, but will need to be changed after run mode has ended.
8. Checking the Auto Rotate box will rotate the model on the x axis and/or y axis, and the rotate speed can be set.
9. Checking the Drag to Rotate box will allow the model to be rotated by draggin the mouse over the model. Auto Rotate and Drag to Rotate can be used together.
10. The Time before Destroyed settings is the time in seconds before the cloned model, the camera, and render texture are removed from the scene. This time can be estimated to be longer than the display of the Canvas. It is not recommended to set this too high, as cloned obejcts, rendertextures, and Canvas Cameras can be resource intensive.
See the Tutorials section for more information and how to create a window to inspect objects.