GUI animated ??

Hi All,

I was wondering if someone could help me, basically i have a GUI on the screen at the top left hand corner. Thats all but what i want to do is animate it i have created a sprite sheet in photoshop. How do i apply this to my GUI? do i make a GUISkin in the script ?

Unity, at the current time (version 3.3), does not include a sprite sheet/atlas GUI handling mechanism.
In order to use your image as a sprite sheet for animating your GUI you will have to either:

  1. Program the mechanism yourself - a pretty complex task.
  2. Purchase the Sprite Manager from the asset store.
  3. Wait for, presumably version 3.5 (could be later) of Unity, where the Unity guys have said they hope to include an atlas manager solution in Unity.

Programming it yourself is not too hard depending on what you want to do. If you do not need to rotate the object, but just move it, you can just modify the pixel value of the object’s placement on the screen with +=. For instance, you could do positionx += 2, which would add two to this value every frame.

function Update(){
positionx +=2;
}
function OnGUI(){
if(GUI.Button(Rect(positionx, 0, 100, 100)){
//whatever
}
}

This simple script would move your object to the right across the screen at a rate of 2 pixels per second. So if this is all the animating you want to be able to do, then it would be quickest to just program your GUI yourself.