Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Infamous on October 01, 2019, 06:55:39 AM
-
Hello there-
I tried searching for answers with no luck.
I have a prefab (building) that gets created when a player tries to build.
The prefab has 2 children, child A and child B. At start Child A is active and Child B is inactive.
I am referencing objects to activate and deactivate through local fsm variables and sets those inside the global controller upon request to show child B and Hide child A.
The issue happens when I try to create another prefab after I show child B and hide Child A.
The new instance shows up with Child B showing and child A hidden. It also retains some local variables from the last created instance.
Sorry if this is not clear or a beginner question. But I tried many things and couldn’t figure out why it’s cloning the last instance instead of the actual prefab. Is it because the prefab is creating the prefab? If so is there a different action I should use instead of a “create gameobject” ?
I would appreciate all the help
Thanks
-
Hi.
Can you show how you are creating the prefab as normally when creating a new prefab it should have the default settings.
-
Hello there- I solved the issue by sending an event to an empty game object fsm and that creates the prefab.
As for your question, inside the “prefab” there is an object when you click on it it triggers creat object action and the object is set to the prefab.
However upon inspection during gameplay the value for what object to create is changed to the parent not the prefab.
I really would like to find out if there is a way to have a prefab create a prefab not a clone of self.
If this is not clear please let me know if a screen capture is better or not.
Thanks
-
Hi.
When you create it will always be an instance(clone) from an object, but you can show some images on your setup so we can see whats going on
-
That sounds a bit complicated. I may also read this wrongly but it almost sounds like you try to create a prefab at runtime. Odd.
Are you using an action like "Create Object"? I don't know but maybe your issue occurs because you try to create an object with a FSM that belongs to a prefab and, for some reason, may automatically use the prefab (the owner of the FSM) as the model to follow.
I admit I don't really understand what's going on.
-
For anyone who may run into this problem it seems like the solution is to have an empty object create your prefabs and just have your prefabs trigger that event.