I wrote some code based on an answer to a similar question where the person used JavaScript to illustrate. However, whenever I try it the way they suggest, I get a
“Cannot modify a value type return value of ‘UnityEngine.GUITexture.pixelInset’. Consider storing the value in a temporary variable” message;
Here is the code that is pulling up the error.
//This is inside the Update function
// healthBar is the GUITexture that I assigned in the Inspector
healthBar.pixelInset.width = originalWidth*health/100f;