Hi, I have a GUITexture which content changes time by time.
All texture defined have the same width, but the height may change.
Until now, I have something like this:
void Start (){
messageSize = new Vector2(Screen.width/3, Screen.height/5);
messageGO = new GameObject();
messageGO.transform.position = Vector3.zero;
messageGO.transform.localScale = Vector3.zero;
messageGUI = messageGO.AddComponent<GUITexture>();
messageGUI.name = "Message";
}
void Update(){
if(displayMessage){
timer += Time.deltaTime;
if(timer <= time){
messageGUI.enabled = true;
messageGUI.texture = message;
messageGUI.pixelInset = new Rect(position.x,position.y,messageSize.x,
messageSize.y);
}
else{
messageGUI.enabled = false;
displayMessage = false;
timer = 0f;
currentMessage ++;
}
}
}
So, I was wondering if there is a way to make this messageSize.y adjusts dynamically. Something like we do in HTML, passing width = messageSize.x and messageSize.y = ‘*’.
What I have so far are fix messageSize. I would like that the messageSize.y change to have the necessary size, like we can do in HTML with the parameter height = ‘*’.