Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Lag After Switching Scenes Rapidly
Started by yazan21 Mar 30 2018 08:34 AM

- - - - -
2 replies to this topic
lag composer scenes
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

yazan21

[GLOBAL: userInfoPane.html]
yazan21
  • Enthusiast

  • 53 posts
  • Corona SDK

I have a game scene with a button that takes you back to the main menu. In the main menu I have a button that starts the game. When I rapidly switch between the scenes, memory goes up and the frame rate drops down significantly. How can I fix this?



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,562 posts
  • Corona SDK

Sounds like a leak.  You may be re-creating content when you don't need to on each entry into the scenes.  
 
Take a look at your content creation code and print out messages to the console every time the main creation functions are called.
 
Then, see if you're getting calls when you don't think you should be.
 
Go from there.
 
Just my 2-cents.

PS - Also verify your destruction code is working. It is incredibly easy to leak (hemorrhage) memory if you're new and not super familiar with scope & visibility, as well as the general flow of how Corona works and when content should be removed. 


Edited by roaminggamer, 30 March 2018 - 08:42 AM.


[TOPIC: post.html]
#3

SGS

[GLOBAL: userInfoPane.html]
SGS
  • Corona Geek

  • 2,073 posts
  • Corona SDK

Switch screens slowly? :)

 

As @rg says create and destroy are fundamental and must be addressed.

 

Whenever I create an object the very next thing I do is write the corresponding destroy code.

 

Once I have create and destroy sorted... only then will I actually do something with the object.




[topic_controls]
[/topic_controls]