I have a prefab widget called a "FloatingScreenNotification". It's a pretty simple structure:
The widget, when created, uses Tweens to float upward, displaying a message, for example: "+1 [gold icon]"
The widget works as expected. However, when I create an instance of this prefab, and try to set its position, it is always drawn in the same exact position..
GameObject go
= Instantiate
(FloatingScreenNotificationPrefab,
new Vector3
(-290,
-272,
0), Quaternion
.identity) as GameObject
;
FloatingScreenNotification n = go.GetComponent<FloatingScreenNotification> ();
n.Label.text = "+" + amount.ToString ();
n.Sprite.enabled = false;
//UIWidget widget = n.Widget;
//widget.SetRect (-290, -272, widget.width, widget.height);
-290, -272 is supposed to be at the bottom left of the screen. The widget was created in the middle of the screen, made into a prefab, and removed from the scene.
I've tried setting the GameObject's transform properties, supplying a position in the Instantiate function, and using the SetRect method, and nothing changes visually, the notification is always appearing at the middle of my screen and floating upwards. Is it supposed to be this hard to re-position a UI element during runtime?
