Dynamic line crosshair
The dynamic line crosshair looks the same as the static line crosshair but is optimized to change every frame. It's generated as a group of GameObjects, one per line, with attached Image components. They can move, resize, and change color every frame with a negligible impact on performance.
Create a dynamic line crosshair
- Create a new GameObject.
- Attach the SimpleDynamicLineCrosshair component to the GameObject.
- In the Inspector for the
SimpleDynamicLineCrosshair
component, click Generate Crosshair GameObject. This generates a crosshair Canvas, if one doesn't already exist, and creates the other GameObjects and components required to render the crosshair. - To change the crosshair's appearance in the Editor, modify property values in the
SimpleDynamicLineCrosshair
component. To change the appearance of the crosshair at runtime, use the SimpleDynamicLineCrosshair component API.
caution
Don't modify the crosshair GameObject that's generated by the SimpleDynamicLineCrosshair
component Inspector. To change crosshair properties, modify the SimpleDynamicLineCrosshair
component values instead.