playMaker

Author Topic: Performance slowed down dramatically!  (Read 931 times)

volcank

  • Playmaker Newbie
  • *
  • Posts: 35
Performance slowed down dramatically!
« on: April 14, 2020, 10:31:15 AM »
Hi,
I am making a mobile game ( for iOS) and it is touch based game.  I use mouse pick event to touch the objects on the scene and destroy them. Basically making a game like toon blast. So the same colored objects (lets say candies) if they are touching each other they all get destroyed like a chain reaction.
I also create levels as prefabs in only one scene and each prefab has the game borders level set up and most importantly has around 160 small spheres created at once in that prefab. Also what those spheres make is (they don't have collision and also shadow cast and recieve is off and without rigid body) once they are created they had random events in them and creating 4 different sphere objects with different colors so the level is created like that.

Everything was working fine and the game play started quick in preview like 3-4 seconds and in mobile it had good performance. But I also wanted to add a shop system and I did it with integer variable. So basically I would set that int with playerprefs like if that is 3 then those 160 spheres would spawn a different kind of candy with different colors. So I have 9 different candies. When I did this shop thind things changed totally. now it is taking around 25 secs for preview to start and also same with mobile after showing Unity logo it takes again around 25 seconds for game to start. I wonder what might be the problem. Can that be that the meshes are heavy for all other candies and Unity is calculating them. Or the variable I am using causes that like I should use string instead of integere etc.?

I also have an object standing at top of the candies and when the candies start to be destroyed that object at top starts to fall down like Candy Crush games etc.

The game was almost finished and now I am facing this issue and I would appreciate your advice! Thank you so much!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Performance slowed down dramatically!
« Reply #1 on: April 14, 2020, 06:47:22 PM »
HI.
Create and destroy is very heavy and from what i understand with the 'shop' you do 160 at the same time.

you should pool them instead.