playMaker

Author Topic: [SOLVED]Check if exist  (Read 5043 times)

VascBogdan

  • Full Member
  • ***
  • Posts: 118
[SOLVED]Check if exist
« on: February 07, 2015, 09:49:50 AM »
Is there a way/action to find if an object exists in the scene ? For example, when a gameobject (usually enemy) dies (destroy self) I want to start a new state. (there are different FSMs)
The gameobj. is stored as a GameObject variable but how can I do this ?
« Last Edit: February 08, 2015, 05:13:20 AM by VascBogdan »

billsclass

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Check if exist
« Reply #1 on: February 07, 2015, 11:07:13 AM »
You could se Find Game Object and test if Game Object is Null.

Alternatively, you could create an INT Var and add each time you create an enemy and subtract from it each to you destroy an enemy. Then you can check the INT var total to see if there are active enemies.

I think you need include a little more info about what you are trying to accomplish.

VascBogdan

  • Full Member
  • ***
  • Posts: 118
Re: Check if exist
« Reply #2 on: February 07, 2015, 12:38:28 PM »
But how can I exactly test if the GameObject is null ? I believe this is the solution I want, but how ?

billsclass

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Check if exist
« Reply #3 on: February 07, 2015, 12:43:53 PM »
Search for "Game Object is Null" in the logic category of Actions.
You can fire an event if null (false) or is not null (true).

VascBogdan

  • Full Member
  • ***
  • Posts: 118
Re: Check if exist
« Reply #4 on: February 07, 2015, 12:58:51 PM »
Yes, that's it. I searched for "GameObject" instead of "Game Object" and I didn't even think it can be in Logic, instead of GameObject or something. I am now trying it and edit if something is wrong. Thank you!
edit: Worked extremely fine. Thank's again!
« Last Edit: February 07, 2015, 01:02:26 PM by VascBogdan »