Playmaker Forum

Bug Reporting => PlayMaker Bug Reporting => Topic started by: doppelmonster on April 18, 2013, 10:31:38 AM

Title: templates: "Send event" loses Gameobject [SOLVED]
Post by: doppelmonster 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.
Title: Re: templates: "Send event" loses Gameobject
Post by: Alex Chouls 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.
Title: Re: templates: "Send event" loses Gameobject
Post by: doppelmonster 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.
Title: Re: templates: "Send event" loses Gameobject
Post by: doppelmonster 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?
Title: Re: templates: "Send event" loses Gameobject
Post by: Alex Chouls 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.
Title: Re: templates: "Send event" loses Gameobject
Post by: doppelmonster 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!
Title: Re: templates: "Send event" loses Gameobject
Post by: Alex Chouls 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...