ReticleLines
Represents the GameObjects and components required to render a dynamic line crosshair.
info
Unless you want to extend the functionality of the dynamic line crosshair, you shouldn't need to use this class directly. Instead, to change the look of the crosshair, use the DynamicLineCrosshair API.
Methods
Clear
Destroys all the GameObjects required to render the crosshair.
Initialise
Creates all the GameObjects required to render the crosshair. This generates four GameObjects, one per side of the crosshair.
IsValid
Indicates whether the crosshair is setup correctly.
Returns
Type | Description |
---|---|
bool | true if the crosshair is setup correctly. Otherwise, returns false . |
Indexer
An indexer that provides the RectTransforms associated with each side of the reticle.
Parameters
Name | Type | Description |
---|---|---|
line | ReticleSide | The side of the reticle to get the RectTransform of. |
Returns
Type | Description |
---|---|
RectTransform | The RectTransform that represents the passed in side of the reticle. |
Example
The following example uses this indexer to access each side of the reticle and set its color.
private void ColorCrosshairReticle(ReticleLines reticle, Color color)
{
ReticleSideUtility.ForEach((ReticleSide line) =>
{
reticle[line].GetComponent<Image>().color = color;
});
}