Different crosshairs for different weapons ?

I was wondering if it was possible to somehow apply a different crosshair for each type of weapon in my game (like a shotgun crosshair would look different from an assault riffle and so on) if it is possible, how would I do this? I already have all the crosshairs made and I know how to add a crosshair to the actual game I'm just unsure of how to add a different one for each weapon?

Thanks in advance to anybody that can help.

Set a mode for each weapon. In case you use different Weapon script, then use the OnGUI() in each to appropriately modify the texture. I have been switching textures based on an If Condition. Eg: 1. Set booleans for mode (MissileLauncher / Rifle) 2. If (boolean) , update the Crosshair texture.

Alternatively, you can also use a Switch case if you have more than 2 weapons to deal with.

Some form of controller will need to keep track of either crosshair state and link it to which gun is going to be present (None, Gun_A, Gun_B, Gun_C ...) or the other way round. Seeing as you may need to interact with the environment or just want a crosshair by default (maybe for throwing stuff with physics I have no idea what the game does from just the question) this could be a good idea.

You could also let the character itself be the statemachine and have his/her/it's gunlist automatically load a crosshair texture based on a codewise mathc with the gun ID Type or Tag. if gun from list a crosshair texture is value from 0th from crosshair list if gun from list b crosshair texture is value from 1st from crosshair list

What you definatly will need is:

Something that knows when what gun is equipped OR which crosshair is active A response in (probably the update method/function) which changes the gun to match the crosshair or vice versa.

Breaking it down in smallest possible components

Get current state Set value to match current state

just don't keep loading texture every frame so much better would be

Get current state Set value to match current state if state changed

Live loading per frame is one of the quickest way to lose 99% FPS