Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: dwjkim on August 30, 2013, 01:42:31 AM
-
I coded to resize the label size but obviously the font size is read-only.
subject[idx] = NGUITools.AddChild(mPanel, mLabelPrefab);
label = subject[idx].GetComponent<UILabel>();
label.font.size = 14;
When the labels are instantiated, they are automatically set at 1, 1, 1.
What can I do?
-
i can be wrong, but UILabel is derived from UIWindget which is derivative of MonoBehavior, so it is safe to assume that you can use label.transform
-
subject[idx] = NGUITools.AddChild(mPanel, mLabelPrefab);
label = subject[idx].GetComponent<UILabel>();
Vector3 scale = new Vector3(14f, 14f, 14f);
label.transform.localScale.Scale(scale);
Tried this code and nothing changes. Any other ideas?
-
Weird, it works for me. try calling MarkAsChanged() on it
-
label = subject[idx].GetComponentInChildren<UILabel>();
subject[idx].AddComponent<UIButtonMessage>();
msg = subject[idx].GetComponent<UIButtonMessage>();
msg.target = gameObject;
msg.functionName = "ClickSubject";
msg.trigger = UIButtonMessage.Trigger.OnClick;
label.text = scn;
subject[idx].AddComponent<Task>();
Task task = subject[idx].GetComponent<Task>();
task.tasklevel = level;
task.taskid = idx;
Vector3 scale = new Vector3(2f, 2f, 0);
subject[idx].GetComponent<Transform>().localScale.Scale (scale);
I have no idea what that MarkedAsChanged is.
I tried this code and it still does not work. I tried using button instead of label and it does not get resized.
Would it be because the panel is a UI Table? I think I tried around that but I do not think it is because the panel is UI Table.
buttons are clones of a single prefab.
-
label.transform.localScale = new Vector3(300f, 200f, 1f);