playMaker

Author Topic: Destroy an object after X seconds  (Read 2266 times)

PET

  • Full Member
  • ***
  • Posts: 139
    • GamerPET
Destroy an object after X seconds
« on: September 02, 2015, 09:38:01 AM »
Hello there,

I created a small capsule that shoots some bullets. Since I don't know (yet) how to create a proper Object Pool I was thinking on automatically destroying the bullets after X seconds.

Any idea how to do that?

P.S. My bullets automatically destroy when they hit an enemy, but if they don't they will just remain in the scene.
Technical Game Designer
www.GamerPET.com

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Destroy an object after X seconds
« Reply #1 on: September 02, 2015, 10:13:32 AM »
wait X seconds -> destroy

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Destroy an object after X seconds
« Reply #2 on: September 02, 2015, 10:41:43 AM »
Or use a collider around your game area so if it exit the colider -> destroy

You should check the unity tutorials for more info..

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: Destroy an object after X seconds
« Reply #3 on: September 02, 2015, 12:36:40 PM »
'Destroy Object' also has a delay to set the timer.
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

PET

  • Full Member
  • ***
  • Posts: 139
    • GamerPET
Re: Destroy an object after X seconds
« Reply #4 on: September 02, 2015, 01:28:52 PM »
Thanks. I was using "Destroy Self" at the end.
My problem was that I was only getting there if I was having a colision.

I did something like this:

Technical Game Designer
www.GamerPET.com