Search Unity

Anyone else experiencing this???

Discussion in 'PSM' started by davem250, Nov 16, 2014.

  1. davem250

    davem250

    Joined:
    May 28, 2013
    Posts:
    186
    Hello all, i am trying to optimize my game so i can run the game at a steady speed of 60fps, but when i decided to try and use Raycasting instead of colliders (= an extra gameObject with an extra collider!) then it didn't change anything neither to the worse or better... but as soon as i did the same approach on nearly 140 gameObjects in the same scene, it suddenly changed the framerate down to a mere 3.00fps how come that be??? Also is anyone else experiencing a tremendous boost when playing your game on the Vita and destroy enemies??? i get a boost for every destroyed enemy of approx 5-7fps which is insane as the enemies i use currently only have 6K tris...

    Thanks in advance :)
    ~David
     
  2. jesusluvsyooh

    jesusluvsyooh

    Joined:
    Jan 10, 2012
    Posts:
    377
    The same David that posted a similar message on PSM forum? :p
    Well it sounds like the problems to do with your enemies, maybe coding, mesh colliders, crazy textures with fancy shaders all sorts.
    Use trial and error, disable the enemy script on your enemy prefab, so when it spawns its not running the script, but your enemies are still being loaded into the map with all there meshes, colliders and shaders.
    If the performance is still bad or same as before then we can rule out the script/coding.
    If your game suddenly performs really well then we'l look into your enemy code and help you see whats causing it.
     
  3. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    592
  4. davem250

    davem250

    Joined:
    May 28, 2013
    Posts:
    186
    Yup, that's me ;) well i can eliminate the shaders (using Unity's default Diffuse Shader!)

    Also i just came up with a thought...
    Can the framerate drop be caused by my NPCDeathtrigger.cs script calling an:

    Code (CSharp):
    1. public static int
    from another script? Or can it possibly be because of the way to get a component through script in Unity 5 that is now mandatory (at least i have not been able to find any other solutions :/ )
     
  5. davem250

    davem250

    Joined:
    May 28, 2013
    Posts:
    186
  6. davem250

    davem250

    Joined:
    May 28, 2013
    Posts:
    186
    @blackbird - i have just figured out the term "pooling" and i can now see that i unfortunately cannot use this feature as my game is consistent (it's a Crash Bandicoot look-a-like platformer!) and i thought i could pool on certain objects so they were instantiated only from the start of the scene, which (if i have understood pooling correctly) is what pooling Can do but pooling keep on re-using the same instantiated objects, which i unfortunately cannot do, i might try to create a level manager script which instantiates certain objects in the scene a certain amount of times, but if that does not make the overall play better then, i might have to wait until Unity5 comes out for the PSM platform to see if that helps better... but what i am trying to say regarding the instantiations is that, i have 89 stars in my scene and they all need to be there at once (they are only 20 poly's each) because i have a counter that counts how many game objects with a certain tag are in the scene, in my case how many stars there are in my scene!

    This is because each star is a collectible and the reason i need the counter is because i have two "gems" one that starts visible but is destroyed if player get 1 star, and another that is only available if the player gets all stars, so every line of code is essential, but i will try to keep diggin' and i will return here if i find a workable solution, but to stay on-topic, can my lagging in the game be caused by too many scripts being called from start (i am actually re-using many of the scripts so there aren't THAT many scripts :p)???

    Thanks in advance, and i am not trying to get a complete solution from any of you ;) i am just trying to get some info on Unity like, if it is possible that the scripts can disturb that much and all that ;)

    ~David