playMaker

Author Topic: templates: "Send event" loses Gameobject [SOLVED]  (Read 3740 times)

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • Grinder Games
templates: "Send event" loses Gameobject [SOLVED]
« on: April 18, 2013, 10:31:38 AM »
When i use a send event action in a template the adressed Gamobeject gets lost after a build or after i close and reopen unity.
« Last Edit: May 08, 2013, 03:27:51 AM by Alex Chouls »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: templates: "Send event" loses Gameobject
« Reply #1 on: April 18, 2013, 10:41:08 AM »
Is it a scene object? In Unity, assets (prefabs etc.) cannot save references to scene objects. Instead you have to find the scene object at runtime.

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • Grinder Games
Re: templates: "Send event" loses Gameobject
« Reply #2 on: April 18, 2013, 12:11:06 PM »
Hi Alex,
its just an empty Game Object with a Playmaker FSM component im adressing. when i set the  template to non in the component and use a normal FSM instead the send event action will hold the same Game object without a problem.

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • Grinder Games
Re: templates: "Send event" loses Gameobject
« Reply #3 on: May 02, 2013, 06:12:06 AM »
After further exploring templates i can state now that every game object i specify in a template action get lost when i build the project (Just hitting play in gameview works well). So its not only "Send event".

Can someone confirm this?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: templates: "Send event" loses Gameobject
« Reply #4 on: May 07, 2013, 03:28:50 PM »
Templates cannot reference scene objects. It will look like it works in the editor, but when you make a build or reload the project these references will be lost. This is a Unity limitation.

It sounds like that's what's happening here... Are you referencing scene objects in the Template?

Instead you should find and store scene objects at runtime using Find Game Object with a name or tag.

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • Grinder Games
Re: templates: "Send event" loses Gameobject
« Reply #5 on: May 08, 2013, 03:00:42 AM »
Ahhh! I didnt understood what you mean by "scene object"  :D

Now i understand the problem and yes i tried to reference scene objects (game objects) in my templates.

Great, i will use "Find Game Object" then!

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: templates: "Send event" loses Gameobject
« Reply #6 on: May 08, 2013, 03:27:33 AM »
Yeah, sorry I use "scene objects" because this rule applies to anything dragged from the scene to a prefab or template. E.g., if you drag components into variables fields the same thing will happen.

The Playmaker GUI should actually prevent you from doing this, but it must not be properly enforced with templates. I'll take a look...