So, I have a GameObject which is some ugui text. It was created in a canvas, anchored to the lower left corner, pivot set to 0,0, and position set to 50,20. I then attached an FSM that gives it some basic fade-in/fade-out animation, and saved the GameObject as a prefab.
The idea is that i'll spawn this prefab whenever I need some dialogue, using the ugui Set Text action to change what's being said. The spawning is done by using a Create Object action (using the Canvas as a spawn point) and then using Set Parent to attach it to the canvas.
For the most part it works fine, but for the life of me I can't get the positioning right.
I've tried using a combination of Set Position, Rect Transform Set Local Position, and even Rect Transform Screen Point To Local Point In Rectangle, but I never get the positioning spot on, it's either a bit off or way off. Heck, Rect Transform Set Local Position didn't seem to make any difference at all.
I guess the skinny of it is; how do I spawn a prefab UI element into a ugui canvas with the correct positioning?