Other considerations when working in World Space
For the most part, working with UI in World Space isn’t much different than working with UI in Screen or Camera Space. There are a few things you have to keep in mind, though.
When working with 3D scenes, you may want your UI to always face the player, regardless of how the player turns the camera—this is known as a billboard effect. You can achieve this with a simple LookAt()
function on the transform of the object in the Update()
function:
transform.LookAt(2*transform.position-theCamera.transform.position );
You can use a variation of the preceding code, depending on how you want the rotation to behave.
Another consideration with 3D World Space UI is the distance it is away from the camera. You may want to have UI only render when it is a specific distance from the camera as it may be difficult to see when it is too far away.
Depending on your project, using World Space Canvases may cause difficulties with...