I want my reticle to expand when I shoot stuff, but I don’t know how. Any help will be appreciated.
BTW, here’s my crosshair texture.
I want my reticle to expand when I shoot stuff, but I don’t know how. Any help will be appreciated.
BTW, here’s my crosshair texture.
This depends a great deal on how you want to display your crosshair. If you’re using the most obvious method of dropping an Image UI element into the center of the canvas then a good way would be to set the pivot to the center of the reticle (which you should have already done anyway) and then simply adjust the scale using a script like this:
public Image reticle;
public float reticleSize = 1.0f;
public float delta = 0.01f;
Update() {
reticleSize = Mathf.max(1.0f, reticleSize-delta);
if ([player has shot])
reticleSize += [accuracy delta value, perhaps from the weapon class];
reticle.GetComponent(RectTransform).sizeDelta = new Vector2(reticleSize, reticleSize);
}