Page 1 of 1

UGUI Dialogue System Issues with Canvas Scaler and Positioning

Posted: Fri Mar 13, 2015 8:02 am
by SixTwoSix
Okay, so I've been trying to update the dialogue system to utilize UGUI, but I'm having a few problems. First of all, despite the fact that I have a Canvas using Screen Space Overlay and which has a Canvas Scaler that is set to Scale with Screen Size, the dialogue system does not have its size updated when it is first instantiated into the game. That is to say, while it will scale with changes to the screen size once you have begun playing, it will always start at the same size no matter your resolution.  It is always 300 pixels across when you first start, regardless if you are playing it 960x540 or 1920x1080.



This issue is compounded by issues I am also having with positioning. When the Dialogue UI is instantiated, it receives a bizarre transform that shifts it from the bottom of the screen, to several hundred pixels to the left and below the game window. I have been able to replicate the transform issue by dragging the prefab into the scene, and then parenting it to the Dialogue System Canvas afterwards. If I bring the the Dialogue UI into the scene by dragging it onto the Dialogue UI Canvas (thus parenting it immediately) this issue is negated and the UI is in the proper position.



If anyone has some ideas for where to start on these issues, please let me know, especially if these were known issues that have been fixed, it would probably allow me to convince everyone to update to the latest version of this plugin. I originally thought these might be issues on Unity's end, perhaps it wouldn't scale it because it wasn't in the scene, but in another part of this game I repeatedly instantiate Dialogue Panels with buttons, text and input fields and have never had these sorts of issues with them. Currently I'm looking through the Source Code trying to write a script to fix all of these issues after the fact, but a solution to the issue altogether is obviously preferred.

UGUI Dialogue System Issues with Canvas Scaler and Positioning

Posted: Fri Mar 13, 2015 8:25 am
by Tony Li
Hi,



For Unity UI, your dialogue UI should be in the scene, not a prefab. This allows you to specify which canvas it goes under. Otherwise the Dialogue System doesn't know which canvas to use.



More info here. In particular:

IMPORTANT: For Unity UI, your dialogue UI must be a scene object, not a reference to a prefab. Assign the scene object to the Dialogue Manager's Dialogue UI field. Unity UI requires two elements in the scene: a Canvas and an EventSystem. You can make them children of the Dialogue Manager GameObject if you want them to persist through scene changes.

If that doesn't help, please let me know. Working with Unity UI can sometimes be frustrating just by itself. I don't want any peculiarities of the Dialogue System to unnecessarily add to that frustration.

UGUI Dialogue System Issues with Canvas Scaler and Positioning

Posted: Fri Mar 13, 2015 8:58 am
by SixTwoSix
Thank you very much, Tony, that seems to have fixed our issues. I hadn't originally set up the Dialogue UI, so I really had no idea what I was doing here. Its been rather interesting since we have been using the new Unity UI system since the early beta, so I have some difficulty telling if I'm doing something wrong, or just using an old, bugged UI element. Thanks again!

UGUI Dialogue System Issues with Canvas Scaler and Positioning

Posted: Fri Mar 13, 2015 9:02 am
by Tony Li
Happy to help! If any other issues come up, or if you have feature requests for the Unity UI support, just post here or email me directly (tony (at) pixelcrushers.com).