Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: 1dpcltpm on September 01, 2016, 11:33:07 PM

Title: Spawn Point reference (in prefab) breaks in "Create Object" action[SOLVED]
Post by: 1dpcltpm on September 01, 2016, 11:33:07 PM
Hello,

I been having an issue with the "Spawn Point" reference breaking inside the "Create Object" action. And I'm not sure if this something I'm doing wrong.
This happens when it's turned into a prefab.

I'm not a coder so I'm not familiar with all the terminology when it comes to searching the forum for answers.

I have found plenty on referencing scene objects but not sure if this is what they're talking about. I saw something about calling a global variable at runtime relating to that scene object but I'm not sure if this pertains to my issue.

Attached is a screenshot of the Spawn Point reference I keep losing.

Thanks in advance for any help you can provide.

David



Title: Re: Spawn Point reference (in prefab) breaks in "Create Object" action
Post by: jeanfabre on September 02, 2016, 01:37:58 AM
Hi,

 It's likely because you are trying to reference that doesn't exists anymore when you hit play.

typically, I guess your fsm is on a prefab and so within a prefab you can't reference scene objects. It's a Unity restriction.

Bye,

 Jean
Title: Re: Spawn Point reference (in prefab) breaks in "Create Object" action
Post by: 1dpcltpm on September 03, 2016, 12:07:51 PM
Jean,

Thanks for the clarification on this. I'll have to work on a plan B.

David

Title: Re: Spawn Point reference (in prefab) breaks in "Create Object" action[SOLVED]
Post by: jeanfabre on September 05, 2016, 04:16:00 AM
Hi,

 plan B is likely

-- sending an event to the newly instanciated prefab and tel it what is the gameobject reference it needs.

-- let the newly instanciated prefab find the gameobject reference it needs.


Let me know if you struggle with this.

Bye,

 Jean
Title: Re: Spawn Point reference (in prefab) breaks in "Create Object" action[SOLVED]
Post by: 1dpcltpm on September 06, 2016, 07:08:45 PM
Hello Jean,

-- sending an event to the newly instanciated prefab and tel it what is the gameobject reference it needs.

The newly instantiated prefab would be an explosion (unity prefab) that would take place at the location an airplane crashes. I'm not sure how to get that crash location – based on collision or trigger – to instantiate on that spot. Would I use a Get Vector 3? I haven't successfully used that yet so I'm not sure how.

Also, on a different object, I need to play a prefab animation based on a trigger event. Trying to work this out also.

Any help would be greatly appreciated.
Thanks a lot!

David

UPDATE: I tested Get Position (to instantiate at that position) and it seems to be working. Although it seems to instantiates in the center of the trigger object it's colliding with.

How would I make the instantiation location more accurate?

Thanks!


Title: Re: Spawn Point reference (in prefab) breaks in "Create Object" action[SOLVED]
Post by: jeanfabre on October 25, 2016, 02:47:33 AM
Hi,

 when a collision or a trigger occured, use GetCollisionInfo to find the point of impact. Have you tried this?

Bye,

 Jean