Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Ofonna on February 07, 2017, 03:49:34 PM

Title: prefab errors [solved]
Post by: Ofonna on February 07, 2017, 03:49:34 PM
hi guys, i've noticed this issue for a while and would really appreciate a response.

every time i create a prefab having an fsm, it generates errors that arent in the main object, no matter how much i click apply, the error never goes and the prefab never updates.
Title: Re: prefab errors [please help]
Post by: elusiven on February 07, 2017, 05:46:27 PM
What errors? Any more information please :P
Title: Re: prefab errors [please help]
Post by: marv on February 07, 2017, 06:03:02 PM
Are you maybe accessing other gameobjects or FSMs on other gameobjects directly from the FSM on the prefab. You can't do that with prefabs. You'll have to use gameobject variables (either global or otherwise passed to the prefab fsm in question) instead.
Title: Re: prefab errors [please help]
Post by: Ofonna on February 08, 2017, 02:24:50 AM
hi guys thanks for your reply,

i have a navmesh agent (zombie),I set up his fsm up with a several states, one being "set agent destination as gameobject" - specify game object(i dragged my player in the slot), after everthing i made the zombie a prefab, but errors pop up in the "set agent destination as gameobject" state, my player is no more in the slot and wouldn't drag in there.

my snap shot for some reason has refused to work....i hope this explanation was clear
Title: Re: prefab errors [please help]
Post by: marv on February 08, 2017, 04:56:30 AM
It's as I said. You can not use a gameobject that is in the scene directly in any local variable/action of a prefab. You'll have to either have the FSM search for the gameobject (the player) -for example via tag-; pass the gameobject (the player) to the prefab with an FSM that is already in the scene; or store the gameobject (the player) in a global variable and have your prefab use that global variable in actions.

As an example:
I assume you create more zombies in runtime. For way #2 you'd then simply add a "set fsm gameobject" action to the FSM creating the zombie object and use it to set the player object in the newly created zombie object.

cheers
Title: Re: prefab errors [please help]
Post by: Ofonna on February 08, 2017, 09:39:41 PM
thank you marv, you can test the game, was a minigame i made in roughly 2 days.
you can't die tho, when you fall just shoot your gun and you'd get back up
 http://tiny.cc/2892iy