Skip to main content

BaseComponent

extends MonoBehaviour

Description

The BaseComponent is the foundation for UCGUI's component system.

Building on top of Unity's MonoBehaviour the BaseComponent provides access to many core elements required for configuring your user interfaces.

For example, GetRect() gives you access to a reference to the RectTransform of the object. IgnoreLayout() adds a LayoutElement behaviour and sets it to 'Ignore Layout'. This is especically useful if you want to directly parent an object to another object which contains some fort of layout (i.e. horizontal or vertical) and you do want your element remain independent of such alignment.

The BaseComponent serves as the most low-level and light-weight element in UCGUI. If you are in need of an easily customizable MonoBehaviour you can use the BaseComponent for quick control over rect properties like size, position, anchors etc.

tip

As UCGUI makes use of the Fluent Interface pattern having general purpose methods in a non-generic class would lead to loads of casting between classes. Therefore, UCGUI additionally makes use of CSharp's Extension Classes to make these generically available when working with any class inheriting from BaseComponent.

These are all stored in a separate file.

Implementation