(P2) :Create Background Scoll.
b1: Create GameObject Squad
b2: Create Material
Create material using shader: Mobile/Particle/Alpha Blended
b1: Create GameObject Squad
b2: Create Material
Create material using shader: Mobile/Particle/Alpha Blended
b3: Setting Image Background
choise Texture type :Advance, wrap Mode: Repeat
B4: Script Animation
Create File Script name is: AnimatedTexture using parameter Speed is Vector2
public class AnimatedTexture : MonoBehaviour {
public Vector2 speed = Vector2.zero;
private Vector2 offset = Vector2.zero;
private Material material;
// Use this for initialization
void Start ()
{
material = GetComponent<Renderer> ().material;
offset = material.GetTextureOffset ("_MainTex");
}
// Update is called once per frame
void Update()
{
if (PlayerPrefs.GetInt("IsRunning")==1)
{
// flow move to Ox or Oy
offset += speed * Time.deltaTime;
material.SetTextureOffset("_MainTex", offset);
}
}
}
0 comments:
Post a Comment