Forum rules - please read before posting.

Scene changes handled by scene names?

edited August 2014 in Technical Q&A
Is there a way to use scene names instead of index numbers to handle scene changes? Adding a title screen to my project threw the scene changing logic off throughout the project (including the loading screen.) I can foresee this becoming a bigger issue as the project grows larger.

Thanks!
Ben

Comments

  • edited August 2014
    That's Unity default workflow....

    but...

    And now that is for Chris ;)

    On Unity games it's useful to use a enum for the scenes->build nº to ref them by "name" when scene loading. Maybe here the scenes(rooms) added to the build should be managed by AC, adding and removing them to the build settings and retrieving back the assigned number (or assigning it yourself, it's just an array), so it can keeps a string enum instead of the scene number.

    You can use EditorBuildSettings to add via script scene files to the build settings. An example here:

    http://forum.unity3d.com/threads/how-to-add-scenes-in-build-with-script-with-editorbuildsettings-scenes.116210/

    Hope it helps :)
  • Perhaps you aren't aware, but it's possible to re-order the Build scenes simply by re-arranging them in the Build settings.  You can do this to put the numbering back to their original state.
  • The new "Title Screen" scene took slot 0, bumping the rest out by 1. I can work with it as it is though, was just wondering if there was something I was overlooking.

    Thanks for the code example MaaS, it was an interesting read. Probably a bit more complicated than what I need though!
  • You should be able to drag "Title Screen" all the way to the bottom - thereby lowering everything else by 1.
  • I need it to load first, thus its position at slot 0. Is there a way to force Unity to load the last scene first, before any other? As I understand it the first scene in the list is always the first to load. After that it's up to the programming (though web streaming relies on the build order, which could result in longer waits if the scenes are out of order.)
  • Ah, yes - you're right about that.  You could, though, just make an "interim" scene 0, that simply does nothing but load the true opening scene.

  • I think you're right. I should plan to have a scene 0 set up to load the game quickly, then go from there.

    Thanks again!
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.