Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

UI loading issues on scene change.

edited December 2016 in Technical Q&A
Hi, I've have found a really weird behaviour in the loading of my UI (found it while building a tittle scene for VR). I've no clue if it has anything to do with AC, but it does seem to affect the menu system. So, I've come to ask for advice. It also better be noted that I had not noticed this before because I was mostly using Prefabed UI, really, the strange behaviour with my "in Scene" worldspace inventory menu was most probably a prelude to this. Anyway, basically whenever I scene change any in-scene UI sort of breaks and my prefabbed UI stop being under DontDestroyOnLoad. If I open the scene directly everything works right, but if I come from another scene the position in in-scene UI is wrong and, if I check the menu manager, in-scene menus just shows "none" in all the fields as if AC was not able to see them at all. Also, prefabed UI move from under Don'tDestroyOnLoad and unto the regular _UI empty game object and stayu that way in subsequent scene changes (not sure if that's normal or not, but it's not how a first time opened scene behaves). another strange thing is, that even though In-scene UI in the menu manager shows all fields as "none" they still get populated and sort of work, but the positioning gets screwed up (weirdest is all canvas and empty objects show no change in their tranform/rect transform yet still look displaced). If I use the RebuildMenus command, which I had stopped using, then all the prefabbed UI returns to being inside Don'tDestroyOnLoad but other hand placed, scene UI, breaks completely. Anyway, I've no idea what could be causing this... It might be a unity issue though, as the positionign getting screwed happens even to two UI billboards which are not connected to AC (the two logo billboards). Ah, all are Worldspace Canvases.

Anyway, here's some quick screenshots from when I though it was something else, I'll get better ones later (It's really late here and I'm beat, sorry). The right one is when the UI is higher up. As usually, any advice will be greatly appreciated (or any ideas).

imageimage

Comments

  • I'm really not clear on what the problem is, exactly.  In what way do the in-scene UIs break?  The screenshots don't illustrate too well what's happening vs what should be happening.  Does the moving of the prefabbed UIs have any effect on their actual behaviour?

    What Unity does with objects marked as "Don't destroy on load" seems to be version-dependent.  What version of Unity are you using?
  • it's Unity 5.5.0f3. Basically the UI in that scene should be staying up high in the air, first pic. When I load the scene directly it works, but whenever I get to this scene through another scene all the UI is suddenly close to the floor (transforms report no change though). All those UI in the pictures except one are just billboards with data, so they have absolutely no scripting in them. Also as I mentioned when the error happens if I check the menu manager for the in-scene UI, all their fields, like canvas and rectTransform, show up as none (even though, when I load the scene directly they get populated just fine), it's as if they were not found, yet in the scene the UI gets turned on but appears all lower. Not sure if It's related but it seems as if AC is losing the references to the in-scene UI shortly after opening them.

    About the prefabbed UI, I'm not sure if it's supposed to stay parented to the Don'tDestroyOnLoad scene, but as I said, when the I load from another scene all the prefabbed UI, even if disabled, moves from the Don'tDestroyOnLoad scene to the _UI empty inside the scene, is that normal?
  • As I said, it'll be dependent on Unity version and also platform.  I'll try to recreate both issues in 5.5.0, but how are you positioning the in-scene UIs?  You say the transforms report no change, but there must be one somewhere.
  • edited December 2016
    Edit: never mind, I had been printing the canvases' position but then I noticed the actual _UI empty IS getting displaced,  had given it a Y offset (.75) but whenever I get to that scene from another one the _UI empty seems to zero out. I solved it by renaming the empty to something else. Does AC reset the position of its autogenerated "folder" empties when there's an scene change??? 
  • It does, but it should only ever be doing so to those that aren't rendered in World Space.  Such canvases are correctly ignored when generated for the first time, but I've found a bug that was causing them to be re-parented after a scene change, regardless of their Render Mode.  Will be fixed in v1.55c.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!