Playmaker Forum
Bug Reporting => PlayMaker Bug Reporting => Topic started 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.
-
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.
-
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.
-
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?
-
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.
-
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!
-
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...