Search Unity

[Extreme beginner] Question about projectile efficiency

Discussion in 'Physics' started by tomo019, Nov 30, 2016.

  1. tomo019

    tomo019

    Joined:
    Apr 28, 2016
    Posts:
    6
    Hello, I am very new to Unity, and making games in general, with little to no knowledge on C#. I use PlayMaker for 99% of my scripting needs, but am very eager to learn more.

    I am making a Tower Defense game, and I am looking for advice about setting up the projectile. I am sure I am not doing this the most efficient way, and wanted to get some basic guidance.

    Currently, I have the Turret create an empty game object (prefab projectile), then store that object, and add force to the object. The projectile is a sphere that I elongated on the Z axis and gave it a material (effects/additive/two-color). The projectile has a collider that triggers when hit "enemy" or "ground" tag. If it hits the enemy, it gets it's health, sets velocity to 0, and subtracts a health amount. If it hits the ground it destroys self, and if it hits nothing, it waits a 1 second timer and destroys self.

    The issue I am having is, since there are several turrets, all firing from 4 barrels each, the amount of projectiles created is causing the FPS to drop dramatically. It typically runs at about 70FPS prior to any turrets firing, but drops to 30FPS at the first Turret, and goes down from there. I am using camera volume occlusion culling, but may not effect cloned objects.

    So I am thinking:
    1) Instead of the prefab being a 3D object, would it be more efficient to make the projectile a Sprite billboard facing the camera with a box collider?
    2) would it be wiser to have the collision actions be handled by the hit object, rather than the projectile?
    3) Does the (additive/two-color) material shader make a significant difference in processing, as opposed to say a standard diffuse shader?

    Thank you in advance!!

    -Thomas
     
  2. tomo019

    tomo019

    Joined:
    Apr 28, 2016
    Posts:
    6
    My apologies, many of my questions were answered watching the tutorial series by UnityCookie on youtube