Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

How to reload "scene"?

Discussion in 'Project Tiny' started by developer_plus, Apr 5, 2019.

  1. developer_plus

    developer_plus

    Joined:
    Jan 10, 2017
    Posts:
    10
    How can I reload my level when player die?
    I'm destroying the main entity, and then trying to reload the same entity, but everything is white.
     
  2. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    This is very basic level stuff, which you should really have learned by doing some tutorials and basic research (aka search google).

    But for the sake of having an answer here...

    https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.LoadScene.html

    EDIT: Oh gosh - I might be an @%&hole.... did not realize this was posted to project tiny section >.<

    Anyway, I don't actually know how to do it with project tiny - forgive my being short with you, been a long few days for me :)
     
  3. developer_plus

    developer_plus

    Joined:
    Jan 10, 2017
    Posts:
    10
    Hi, i'm sorry if i was not clear but what mean to ask is how can i reload the game in Tiny since there's no SceneManager...
    Thanks

    Edit: I wrote this while you were editing. It's ok : )
     
    MD_Reptile likes this.
  4. reallyhexln

    reallyhexln

    Joined:
    Jun 18, 2018
    Posts:
    69
    How do you create the main entity?

    I use empty "Bootstrap" entity that is launched automatically when the game is started.
    Then I manually create the main scene using the following code:

    Code (JavaScript):
    1. ut.EntityGroup.instantiate(world, GAME_SCENE_NAME);
    When a player character dies, I stop all active processes (tweeners, active components) and call:

    Code (JavaScript):
    1. ut.EntityGroup.destroyAll(world, GAME_SCENE_NAME);
    Please check the console of your browser to ensure there are no errors while scene re-creation.
    Also check if your scene has properly configured camera.