playMaker

Author Topic: Spawn Point reference (in prefab) breaks in "Create Object" action[SOLVED]  (Read 1283 times)

1dpcltpm

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
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



« Last Edit: September 05, 2016, 01:14:57 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14471
  • Official Playmaker Support
    • View Profile
Re: Spawn Point reference (in prefab) breaks in "Create Object" action
« Reply #1 on: September 01, 2016, 10:37:58 PM »
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

1dpcltpm

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: Spawn Point reference (in prefab) breaks in "Create Object" action
« Reply #2 on: September 03, 2016, 09:07:51 AM »
Jean,

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

David


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14471
  • Official Playmaker Support
    • View Profile
Re: Spawn Point reference (in prefab) breaks in "Create Object" action[SOLVED]
« Reply #3 on: September 05, 2016, 01: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

1dpcltpm

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: Spawn Point reference (in prefab) breaks in "Create Object" action[SOLVED]
« Reply #4 on: September 06, 2016, 04: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!


« Last Edit: September 06, 2016, 04:41:01 PM by 1dpcltpm »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14471
  • Official Playmaker Support
    • View Profile
Hi,

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

Bye,

 Jean