Hi ,
I new to Unity3D, doing simple form with 2D effects. i need to scale a image for 5 Seconds. how could i do this. i added a image using
now i have to scale the Texture2D i mean Zoom in and Zoom out effect. please give me glue to execute this
Hi ,
I new to Unity3D, doing simple form with 2D effects. i need to scale a image for 5 Seconds. how could i do this. i added a image using
now i have to scale the Texture2D i mean Zoom in and Zoom out effect. please give me glue to execute this
Javascript:
var texture : Texture2D;
var position : Vector2 = Vector2(250,250);
var scale : Vector2 = Vector2(1,1);
function OnGUI(){
GUI.DrawTexture(Rect(position.x-(texture.width*scale.x/2),
position.y-(texture.height*scale.y/2),
texture.width*scale.x,texture.height*scale.y),texture);
}
C# (Csharp)
public Texture2D texture;
public Vector2 position = new Vector2(250,250);
public Vector2 scale = new Vector2(1,1);
function OnGUI(){
GUI.DrawTexture(new Rect(position.x-(texture.width*scale.x/2),
position.y-(texture.height*scale.y/2),
texture.width*scale.x,texture.height*scale.y),texture);
}
Change scale to what you want :), if you need help let me know