I was trying with Custom Styles class inside the GUISkin… but i have no luck with it…
now, i have returned to use guiTexture, i find GUIStyle fantastic, but i guess it only serves to a welcome or customization interface… i will use it for other purposes like increase or decrease powers, items, and other things… even to input passwords…
i have found a simple solution for guiTexture buttons, i have wrote this basic script to manage stretched to fit screen textures and floating textures like my buttons…
enum TextureType{
StretchToFS = 0,
FloatTexture = 1,
}
var textureTypeIs : TextureType;
var floatTexture_xPos : float;
var floatTexture_yPos : float;
function OnGUI() {
if (textureTypeIs == TextureType.StretchToFS){
guiTexture.pixelInset.width = Screen.width;
guiTexture.pixelInset.height = Screen.height;
guiTexture.pixelInset.x = -Screen.width / 2;
guiTexture.pixelInset.y = -Screen.height / 2;
}
else if (textureTypeIs == TextureType.FloatTexture){
var xReference : float = floatTexture_xPos;
var yReference : float = floatTexture_yPos;
guiTexture.pixelInset.x = -Screen.width / 2 + xReference;
guiTexture.pixelInset.y = -Screen.height / 2 + yReference;
}
}
y and x Reference were needed because OnGUI functions are similar to Update… i think…
with this i can definitely resize windows and guiTexture stands on screen for ever… never goes offset anymore…