#1 Support for multiple calls to LoadScene in timeline and friends

Merged
selfsame merged 1 commits from sogaiu/multiple-load-scene into selfsame/master 5 years ago
sogaiu commented 5 years ago

LoadScene causes existing GameObjects to be destroyed by default. timeline and friends depend on the existence of a particular GameObject (-mono-obj).

Thus if LoadScene is used in a timeline, the timeline ends at that point (i.e. subsequent iterations do not occur).

By using DontDestroyOnLoad, -mono-obj can be made to persist across a scene load. This enables use of more than one use of LoadScene in a timeline, e.g.:

(timeline
  [#(log "loading first scene")
   #(SceneManager/LoadScene "title")
   #(log "loaded first scene, now waiting")
   (wait 2.0)
   #(log "waited...now loading next scene")
   #(SceneManager/LoadScene "play")
   #(log "loaded scene...have fun :)")])
LoadScene causes existing GameObjects to be destroyed by default. timeline and friends depend on the existence of a particular GameObject (-mono-obj). Thus if LoadScene is used in a timeline, the timeline ends at that point (i.e. subsequent iterations do not occur). By using DontDestroyOnLoad, -mono-obj can be made to persist across a scene load. This enables use of more than one use of LoadScene in a timeline, e.g.: ```clojure (timeline [#(log "loading first scene") #(SceneManager/LoadScene "title") #(log "loaded first scene, now waiting") (wait 2.0) #(log "waited...now loading next scene") #(SceneManager/LoadScene "play") #(log "loaded scene...have fun :)")]) ```
This pull request has been merged successfully!
Sign in to join this conversation.
No Label
No Milestone
No assignee
1 Participants
Loading...
Cancel
Save
There is no content yet.