Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Fat Pug Studio on February 04, 2019, 02:11:25 PM
-
Hi guys,
I have an issue, but i need to know how some things work to know how to solve it.
I'm using get array list random to get a random GameObject from array list. Now, when i instantiate that object with Create Object Advanced it's ok, but when i use Core Game Kit and set the GameObject to spawn it spawns the wrong thing.
I suppose FsmVar is changeable variable that sets its type depending on the type of variable in the action by using PlayMakerUtils.ApplyValueToFsmVar, but why doesn't it work in things like Core Game Kit?
I'll dig up the code to the action of CGK to see how it's handled there, but isn't FsmVar automatically converted to GameObject variable in the Get Array List Random action?
-
Hi,
you'll need to debug what's being read when you use CoreGameKit, maybe the value is not what you expected because of a logical issue within your fsm? else, what if you wait one frame?
if you have some code sample, it will help, I am not sure how you work with playmaker and coregamekit and where fsmvar are involved ( never used it)
Bye,
Jean
-
Waiting for a frame does not solve it unfortunately.
CGK action for spawning uses FsmGameObject as a reference.
prefabToSpawn = new FsmGameObject();
So, what should i do with FsmVar to use it as an FsmGameObject?
-
Hi,
Sorry, I am not sure I follow, can you give a concrete example with code that I can run so that I see what you are trying to achieve?
why do you want an fsmvar here?
Bye,
Jean
-
Hi Jean,
check pm.
-
Any news on this one? I'll try modifying the action to get random gameobject from array list.
-
Hi,
Did not get any pm :)
Bye,
Jean
-
Ok, i've sent it again.
-
Works when i use setgameobject then use that variable. Thanks Jean!
-
Ok, i have to bump this, there's something fishy going on.
I have an arraylist
(https://i.postimg.cc/nz6Tdhgm/screenshot-229.png)
I get a random item from the array
(https://i.postimg.cc/xjvKr5bh/screenshot-230.png)
I set the game object since it saves the item as fsmvar
(https://i.postimg.cc/V6jb8s5n/screenshot-231.png)
It saves it nice and dandy into variable
(https://i.postimg.cc/x8nNTrb7/screenshot-232.png)
Then i spawn it
(https://i.postimg.cc/J0xDsTNh/screenshot-233.png)
But as you can see it spawns an object that is not even in the arraylist! But the worst thing is that it sometimes does the job properly and spawns the selected game object, and sometimes it spawns this. Worst thing part 2: wrong prefab is always the same.
-
Hi.
From the 1st look of it, it think the core game kit has to do something with it.
try enabling debug (bottom/left on the state window/tab)
and set a few breakpoints.
so you can see as the selected random is correct, if so go next step.
-
Yeah, probably Core Game Kit has something to do, though the code looks clean. I'll check out with Brian anyway.