Playmaker Forum

Bug Reporting => PlayMaker Bug Reporting => Topic started by: Ouren on July 25, 2014, 10:31:43 PM

Title: Get Distance doesn't work~![SOLVED]
Post by: Ouren on July 25, 2014, 10:31:43 PM
Here's an MP4 of the issue:
http://i.gyazo.com/f5bc1f0e51130df59cb2cf9727030f62.mp4

¯\_(ツ)_/¯

Enemy FSM is "Get Distance" from itself to the PlayerHolder (the thing moving in the scene!)
Title: Re: Get Distance doesn't work~!
Post by: Alex Chouls on July 26, 2014, 12:13:17 PM
Maybe something else is using the Distance variable? Setting it to the value you're seeing...?
Title: Re: Get Distance doesn't work~!
Post by: Ouren on July 26, 2014, 05:41:42 PM
(http://i.gyazo.com/468470fd601d9951cf184bec1bcc644b.png)
(http://i.gyazo.com/8377ba18d393e710dc6fd477c0f334e0.png)
(http://i.gyazo.com/957c3d5a12acad60a3eb75b0f3dc624c.png)
Title: Re: Get Distance doesn't work~!
Post by: Alex Chouls on July 26, 2014, 06:12:25 PM
Any chance you could email me the project?
Title: Re: Get Distance doesn't work~!
Post by: Ouren on July 26, 2014, 09:35:47 PM
Sure!~

EDIT:
Done
Title: Re: Get Distance doesn't work~!
Post by: Ouren on July 30, 2014, 02:30:50 PM
You get a chance to look over it?
Title: Re: Get Distance doesn't work~!
Post by: Alex Chouls on July 30, 2014, 11:52:52 PM
The problem is PlayerHolder is a prefab, not an instance of the prefab in the scene. The prefab asset doesn't move, so GetDistance doesn't change!

This comes up a lot with Unity. In the next update I'll look into adding an error when actions should point to a scene object and not a prefab. Most actions should point to a scene object. FSMs on a prefab can also point to child objects of the prefab and these references should get properly remapped (by Unity) when the prefab is instantiated in the scene.

A quick way to see if a referenced GameObject is a prefab or scene object is to press the select icon next to the edit field (circle with dot). This opens the object browser and you can see if the GameObject is an Asset or Scene object. Clicking the edit field will also ping the asset in either the Project or Hierarchy windows, depending on if it's a prefab or a scene object.
Title: Re: Get Distance doesn't work~![SOLVED]
Post by: rik on March 07, 2015, 05:31:35 PM
Hi i was having get distance problem i have make sure i was not using prefab i have removed the prefab associated with the fsm