Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Sign in to follow this  
arwe2793

whats wrong in this simple script

Question

hi, im working on my game optimization, for now i cut aut hell of code from bunch of script, now these script optimized much better, and in Update function i leaved as less code ass posible, but didnt notice no real fps increase :/

 

i using proffiler to see what wrong, like this script 

Please login or register to see this code.

its so simple but as i see, its not fast as i want. when i copy paste 20 of obj with this script, fps drops instantly, if i have one, fps stays as it stays :/

 

 

im uploading screenshot of profiller, can u hellp me to understand and find bootleneck? its 2d game with 2d sprites. soposed

to be hi fps, but its just 170fps, and when i will export on android, it dramaticaly decrease for poor mobile hardware

 

Please login or register to see this link.

 

Please login or register to see this link.

 

 

im new at optimization, so please hellp my to understand :)

Please login or register to see this attachment.

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts


  • 0

yas i was reading right now and found what is gc, so i have approximately

 

66 JatPack.js on Update

128 moobingPlatform.js  on coroutine

74 diamonds.js on Update

 

//and these is default unity script of new ui or something

200 ScroolingBehavior.LateUpdate 

40 GameView.GetMainGameViewRenderingRect()

110 particle Emiter on Update

16  MobileControllrig on Update //2d character controler fromn beta assets

 

 so total is ~630

could u suggest me how much i should cut of these garbages to increase fps noticeably

Share this post


Link to post
Share on other sites
  • 0

Create a customer cleaner which will clean unnecessary objects from scene.

One way could be adding all of them to List<RGCNode> resourceGarbageCollector, after set them all inactive. Then trigger a bool=> update or launch coroutine which will destroy one object per frame.

I'd suggest wrapping the go in class.

Please login or register to see this code.

Update might be a better solution in this case, because what will happen if next coroutine is called before previous finishes?

As you must remove element from end you wont be able to restart and thats isnt really a secure way.

In Update case just break the for loop;

 

If objects repeat, pooling will be the best option.

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

looks difficult :) i dont need to delete anything :P right now i rewriting some script and will see what benefit i get. if wont, take your advice and try this script :)

Share this post


Link to post
Share on other sites
  • 0

one more quostion, is <1kb gc is bad for android devices ? i have around 6ms cpu and 5ms gpu and 180fps on old laptop ( that dont run games like nfs mw 2006 on full res smoothly), is this good for android :d i have to powerful device to test my game, im targeting on lower performance devices

Edited by arwe2793

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...