Unity ライフバー
http://unity3d.com/support/documentation/Components/gui-Layout.html前回紹介したやつだが実際実行すると表示がおかしい
修正したい
/* Using multiple Groups to clip the displayed Contents */ var bgImage : Texture2D; // background image that is 256 x 32 var fgImage : Texture2D; // foreground image that is 256 x 32 var playerEnergy = 1.0; // a float between 0.0 and 1.0 function OnGUI () { // Create one Group to contain both images // Adjust the first 2 coordinates to place it somewhere else on-screen GUI.BeginGroup (Rect (0,0,256,32)); // Draw the background image GUI.Box (Rect (0,0,256,32), bgImage); // Create a second Group which will be clipped // We want to clip the image and not scale it, which is why we need the second Group GUI.BeginGroup (Rect (0,0,playerEnergy * 256, 32)); // Draw the foreground image GUI.Box (Rect (0,0,256,32), fgImage); // End both Groups GUI.EndGroup (); GUI.EndGroup (); }