- Home /
Unable to change borders of a GUITexture in a straightforward way
Hello,
I'm making the classical energy bar rendering thing using to GUITextures :
One texture at the back represents the back of the bar and never changes
One texture is partly drawn on top of the first one, depending on how much energy is available.
I'm therefore trying to draw only one part of my top texture. I managed to get it working by manipulating the pixelInsets and borders properties of GUITexture. So everything seems fine here, EXCEPT I have to write it in a weird way apparently :
// (fgGUITex is my front GUITexture object
// on which I set the pixelInset property previously).
// For some mysterious reason, the borders are not modified if I write this :
//fgGUITex.border.left = (int) (ratio * fgTexW);
// ... this howether works as expected !?
RectOffset ro = fgGUITex.border;
ro.left = (int) (ratio * fgTexW);
fgGUITex.border = ro;
Could someone tell me why my first (commented out) instruction does not do the same as the following lines ? Am I doing something wrong here ? My guess is that I might have ran into some evil C# property that does more than acessing its field without notice ... ?