Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How to Avoid Black Screen When Reloading Scene
Started by yazan21 Sep 20 2018 11:46 PM

- - - - -
4 replies to this topic
scene reloading
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

yazan21

[GLOBAL: userInfoPane.html]
yazan21
  • Enthusiast

  • 44 posts
  • Corona SDK

How can I avoid getting a black screen for a second when reloading a scene?



[TOPIC: post.html]
#2

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,686 posts
  • Corona SDK

A few options:

 

Load a background loading image into an intermediate scene.

 

or...

 

Split up the drawing (and any other CPU-intensive code) of the scene into chunks. Load an image, wait a frame, load some more objects, wait a frame etc. You can use timers or an enterFrame listener for that.



[TOPIC: post.html]
#3

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,243 posts
  • Enterprise

It's hard to know what's going on here without seeing what you're doing. Common pitfalls that hit new users.

 

1. Setting a transition when going to the first scene. Typically you don't create any on-screen visuals in main.lua and use main.lua to go to your first scene. If you put a transition in that composer.gotoScene() call, then it's going to transition from the black default screen to your scene for the duration you set. If you want something on the screen immediately, don't use a transition on the first gotoScene() call.

 

2. You are not creating your scene in scene:create() but instead doing it in scene:show()'s "did" phase. If you're doing this then your code won't even attempt to create your scene until it's on the screen. This can cause these symptoms.

 

3. Doing too much in main.lua, before you attempt to show your scene, can lead to longer times before your scene shows. If you're loading a lot of audio in main.lua for instance, that will slow down your initialization. 

 

Rob



[TOPIC: post.html]
#4

lertefapsa

[GLOBAL: userInfoPane.html]
lertefapsa
  • Observer

  • 2 posts
  • Corona SDK

Facing the same, but here also crashing. Tried resetting but still facing the same issue.

 

Regards,

Smith https://putlocker.ooo/



[TOPIC: post.html]
#5

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,243 posts
  • Enterprise

Hi Smith. What errors are you getting? Please help us help you by providing details on what's going on.

 

Thanks

Rob




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: scene, reloading