Game Development Reference
In-Depth Information
A better way
Now that we've ascertained just throwing the Canvas into 3D space isn't enough,
what can we do?
We simply need a bigger Canvas, one drawn at a resolution that suits our art assets
and works well with the text system as it currently is, then lean on the rendering
path used by the Canvas system and scale it down to the size we need.
This way, the Canvas is rendered at the resolution we want, and then once rendered,
is scaled down to a texture for drawing in our scene.
To do this, do the following:
• Either start fresh or simply set the appropriate width and height values for
the canvas to the resolution we want (say 700 x 400 for example, but it could
be any resolution you want)
• Resize and move the Canvas components (its children) to fit the new
resolution (basically, make them bigger)
• Once you are happy, just scale down the Canvas, either using the scale
tool in the scene view or by manually altering the scale values on the
WorldSpaceCanvas GameObject in the inspector (I'd recommend using
the Scale Tool)
Once you have done this, the quality will go up considerably because the Canvas is
working at a much better resolution.
In practice, the way I would recommend creating World Space Canvases would be
the same as working with Render Textures, for example:
1.
Create your Canvas and switch to 2D mode.
2.
Set the Render Mode of the Canvas to World Space .
3.
Set the Width and Height to a good resolution for the type of element you
are trying to create. If you are using text, the bigger the better (just don't go
silly; use what you feel works best with the font you are using, and try not to
oversize). I set mine to a Width of 700 and a Height of 400 .
4.
Add UI elements to your Canvas and configure/arrange it how you want.
5.
Once complete, place and scale it down to where you want it in your scene.
6.
Done.
You can of course just create it in the overlay mode and then change the Render
Mode afterwards; it's up to you. However, you will then not get a feel of the
resolution of your Canvas that works best for what you are creating.
 
Search WWH ::




Custom Search