I have a prefab that is instantiated on touch input: the player needs to touch and hold for some duration, during which an animation for radial progress around touch position is created by manipulating material/shader attached to the prefab’s sprite renderer.
-
The shader I am referring to is here;
I attached it to a material, which is referenced by the sprite renderer. -
The animation seem to work as expected in editor when I test it out in Play/Game mode, but on android it does not show up at all - unless I move the touch position. Below is a part of the prefab script:
void Start(){ renderer = GetComponent<SpriteRenderer>(); mat = renderer.material; } void Update(){ if (this.charging){ // Below changes the Shader parameter value '_Arc2' // from 360 to 0 within period "duration" float current_value = mat.GetFloat("_Arc2"); if (current_value > 0){ current_value -= 360f / duration * Time.deltaTime; mat.SetFloat("_Arc2", current_value); } } }