Hello everyone,
I can say I am fairly new at game development and have basic programming experiment. But I am curious to learn new things. And I also appreciate this course. In this course I generally try to get things done before watching lecturer’s solution.
In the Block Breaker game, there were a smoke clone issue like projectile clone in this game. When I realise it I tried to solve and accomplished it, yeah My solution for smoke was that I added a script namely “ParticleAutoDestroy” to smoke prefab. It simply checks whether the ParticleSystem alive or not in update() and Destroy if it is not.
As the same way, in laser defender; I added a ProjectileAutoDestroy to PlayerLaser prefab. In script, it finds the uppermost coordinate of the camera view as ymax in Start(). And check the position of the “particle” in Update(); if it is leaves the upper edge of the camera view, it destroy particle game object.
By doing this, it makes destroying task independent from playspace size or frame ratio (if I am not wrong about that Camera.main.ViewportToWorldPoint handle that issue itself). And also no need to add Shredder for Destroying particles (Shredder would be necessary sooner or later for the future development when number of game objects increases and game get more complex).
I just want to share Have good games!
[+ 0.5f is for letting particle completely leaving the view]