Okay I’ve got a battery gui but i want it so that when i click on an object that it would add to the battery and also update the gui as well.
Here is the code I have.
var remaining : float = 0; var pos : Vector2 = new Vector2(20,40); var size : Vector2 = new Vector2(60,20); var battery : Texture2D; var energy : Texture2D; function OnGUI() { GUI.DrawTexture(Rect(pos.x, pos.y, size.x, size.y), battery); GUI.DrawTexture(Rect(705, 355, (size.x-15)- (45 *Mathf.Clamp01(remaining)), size.y-10.5), energy); } function Update() { remaining=Time.time *0.01; }