1.Rotate a texture using GUI
- Effects on Textures.
- Using on Loading...
- Rotate many textures on 1 moment.
public Texture2D LoadingCircle; // This is the image that using for rotate around.
public GUIStyle LoadingFont; // Set up font for the text.
public float angle; // angle for rotate
public Vector2 XY; // Temp Vectors for set position in Screen.
private Vector2 pivotPoint; // Center point for texture rotate.
void OnGUI () // the function draws on Screen.
{
// Draw a text “Loading…” with GUI.Label
GUI.Label( new Rect(XY.x +100 , XY.y -80,300,100),"Loading...",LoadingFont);
// Set angle for the texture’s rotation. The angle will be change every frames.
angle += Time.deltaTime;
// Set center point for the texture’s rotation. Using temp Vectors that modify on the screen when in PlayMode and increase “200” for “x” and “y” to get the center point of the texture on the screen.
pivotPoint = new Vector2(XY.x + 200, XY.y +200);
GUIUtility.RotateAroundPivot(angle * 100,pivotPoint); // Rotate all textures below.
// Draw a “circle” texture.
GUI.DrawTexture( new Rect(XY.x , XY.y,400,400),LoadingCircle);
}
- Using on Awake ().
- Blend many animations 1 moment.
animation.wrapMode = WrapMode.Loop; // set up loop for all animations below.
// All animations that action on full bones of the character. So if you want to make it action on the selected bones, you must use:
animation["Fire].AddMixingTransform(Spine1); // Spine1 is the place that contains all bones that we want.
So after that code explain that. All animations action through all bones the character, just the animation “Fire” effects from the Spine1 to up.
animation["Fire].wrapMode = WrapMode.Once; // Set up PlayMode for animatons.
animation["Fire].layer = 10; // Layer is very important for authenticate animation. It decides the animations's order. The first priority animation that has a highest layer. Default layer is Zero.