Game Development Reference
In-Depth Information
public int Layer
{
get { return gameObject.layer; }
}
float Width
{
get
{
return (buttonSize * buttonColumns) +
Mathf.Clamp((buttonColumnSpacing * (buttonColumns - 1)), 0,
int.MaxValue);
}
}
float Height
{
get
{
return (buttonSize * buttonRows) +
Mathf.Clamp((buttonColumnSpacing * (buttonRows - 1)), 0,
int.MaxValue);
}
}
Note
For more information about class attributes and editor tags, such as [Serial-
izeField] , check out Chapter 12 , Deployment and Beyond , and Appendix , Additional
Resources .
The preceding code just enables us to discover the layer the command bar is assigned to
and ensure any child elements we add can be assigned to the same layer. The remaining
expose the calculated width and height for the entire command bar.
If you create a public variable, it will be visible in the code and the editor, for example:
public float myPublicVariable;
Search WWH ::




Custom Search