playMaker

Author Topic: Does "none" equal null?  (Read 3231 times)

jayhfd

  • Junior Playmaker
  • **
  • Posts: 71
Does "none" equal null?
« on: February 19, 2015, 11:42:20 PM »
I'm trying to debug a situation where Find Closest Object isn't working as intended. It is finding "none".

So I've put in an action to check if the object found above is null, and then to break if that happens. However, that doesn't seem to fire when the game object reads as "none".

Am I getting null and none confused here? I don't get how this isn't a null situation.

Thanks!
Jay

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Does "none" equal null?
« Reply #1 on: March 30, 2015, 06:40:43 AM »
Hi,

 Where did you get that action?

 Bye,

 Jean

jayhfd

  • Junior Playmaker
  • **
  • Posts: 71
Re: Does "none" equal null?
« Reply #2 on: March 31, 2015, 01:04:35 AM »
Just "Find Closest", the included action with Playmaker.

As usual if I try and make a simple test project to see if this works, its fine, but within my project it seems to work sometimes and not others, the worst kind of bug of course! Have even had that action find gameobjects that aren't in the scene when a breakpoint triggers.

However since posting this originally so many things changed that I no longer have the project set up the same way. Have a feeling it may resurface though so I guess I'll make another post if that happens.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Does "none" equal null?
« Reply #3 on: March 31, 2015, 01:42:15 AM »
Hi,

 yeah, I know about that kind of bug...  :'(

Let's see if other mention something on this as well, but as is, I don't experience anything like that, and certainly not ghost objects.

 Remember, destroying an object only becomes effective the next frame. so if you destroy and find on the same frame, you can have trouble depending on the script execution order, which you should not try to control, and so use a next frame event to solve this.

Bye,

 Jean

jayhfd

  • Junior Playmaker
  • **
  • Posts: 71
Re: Does "none" equal null?
« Reply #4 on: March 31, 2015, 03:29:47 AM »
Great thanks Jean I'll keep that in mind with the next frame stuff and that frame delay in destroying. Maybe there needs to be a note somewhere about that 1 frame destruction delay too.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Does "none" equal null?
« Reply #5 on: March 31, 2015, 08:49:41 AM »
Hi,

 yeah, it's a Unity thing, it's in the doc:

http://docs.unity3d.com/ScriptReference/Object.Destroy.html


 Bye,

 Jean

redikann

  • Full Member
  • ***
  • Posts: 174
Re: Does "none" equal null?
« Reply #6 on: March 31, 2015, 03:17:31 PM »
It's been my experience that Playmaker can miss finding an Object if it's in the Start state and that State is fired during scene loading(Or directly after). Playmaker states execute extremely fast so I start with "Game Object is Null " action that fires to a same state Global Event "Find Object(whatever your looking for) then returns to the start state. This way I can loop to find the object and proceed once it is not null(or found).
« Last Edit: March 31, 2015, 03:19:11 PM by redikann »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Does "none" equal null?
« Reply #7 on: April 01, 2015, 03:37:52 AM »
Hi,

do you create that object programmatically or is it in the scene you load?

 again, make sure you listen to the on level loaded system event before acting, and put a next frame event for safety and you'll be good to go without looping or waiting.

 Bye,

 Jean