I added a 3D Object > Quad and added a graphic on it with the Wrap Mode set to Repeat. I'm animating the Offset to scroll the repeating image for a parallax effect. Everything is working perfectly with in Editor and Android devices. On iOS devices, the image shows fine and then stretches as the offset is changing. I'm attaching 2 screen shots of the image import settings - Quad settings, and the issue on the iPhone. Below is my code:
public float scrollSpeed = 0.05f;
private Vector2 savedOffset;
Rigidbody2D player;
void Start () {
GameObject player_go = GameObject.FindGameObjectWithTag("Player");
if (player_go == null)
{
//Debug.LogError("Couldn't find an object with tag 'Player'");
return;
}
player = player_go.GetComponent<Rigidbody2D>();
savedOffset = GetComponent<Renderer>().sharedMaterial.GetTextureOffset("_MainTex");
}
void FixedUpdate()
{
if(player.GetComponent<BirdMovement>().dead)
{
return;
}
float vel = Time.fixedTime * scrollSpeed;
float y = Mathf.Repeat(vel, 1);
Vector2 offset = new Vector2(y, savedOffset.x%1);
offset.x = (float) System.Math.Round (offset.x, 3); //Mathf.Round (offset.x * 10) / 10;
Debug.Log ("Offset:" + offset.x);
if (offset.x > 1) {
offset.x = 0;
}
GetComponent<Renderer>().sharedMaterial.SetTextureOffset("_MainTex", offset);
}
void OnDisable()
{
GetComponent<Renderer>().sharedMaterial.SetTextureOffset("_MainTex", savedOffset);
}