playMaker

Author Topic: [SOLVED] Cannot set FSM variables stored in an object  (Read 3725 times)

ryf9059

  • Full Member
  • ***
  • Posts: 100
    • View Profile
[SOLVED] Cannot set FSM variables stored in an object
« on: June 10, 2013, 09:24:27 AM »
Basically I have a fire action which spawns a bullet and upon the creation of the bullet object (a prefab) a speed variable is assigned to it. I stored the bullet in temp variables and wanted to use set FSM float to set the speed variable that's in the FSM of the bullet. But I can't, the temp doesn't contain any available FSM regardless the bullet object contains 2 FSM. Casting problem maybe?

Let the screenshot explain the problem




Please advise
« Last Edit: June 11, 2013, 11:19:18 AM by ryf9059 »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3643
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Cannot set FSM variables stored in an object
« Reply #1 on: June 10, 2013, 02:23:49 PM »
The Variable Name parameter is a string. So you either enter the name of the float variable, or use a name stored in a string variable. Does that make sense?

ryf9059

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: Cannot set FSM variables stored in an object
« Reply #2 on: June 11, 2013, 08:07:25 AM »
The Variable Name parameter is a string. So you either enter the name of the float variable, or use a name stored in a string variable. Does that make sense?

Still don't understand, the float is stored in the FSM but the FSM option is none in the first place how can I get the name from FSM? Even I type it it's not working.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2494
  • Mender of the past
    • View Profile
    • Cleverous
Re: Cannot set FSM variables stored in an object
« Reply #3 on: June 11, 2013, 08:48:59 AM »
By using that particular dropdown type you're telling it that you want to use a String Variable there.

Click the grey icon to the right to cycle through the dropdown box types until you can select the FSM by name. It seems like that is what is happening, anyway.

ryf9059

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: Cannot set FSM variables stored in an object
« Reply #4 on: June 11, 2013, 09:11:08 AM »
By using that particular dropdown type you're telling it that you want to use a String Variable there.

Click the grey icon to the right to cycle through the dropdown box types until you can select the FSM by name. It seems like that is what is happening, anyway.

I don't quite understand what you are saying because I there is nothing in the dropdown box, I recorded a video for you to see:
http://screencast.com/t/le4facLBkGl

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2494
  • Mender of the past
    • View Profile
    • Cleverous
Re: Cannot set FSM variables stored in an object
« Reply #5 on: June 11, 2013, 09:12:48 AM »
Make sure a target object is assigned.

Toggle the FSM grey button like you just did in the video.

Click the Up/Down arrow button that appears.

Choose the FSM.

ryf9059

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: Cannot set FSM variables stored in an object
« Reply #6 on: June 11, 2013, 10:33:16 AM »
Make sure a target object is assigned.

Toggle the FSM grey button like you just did in the video.

Click the Up/Down arrow button that appears.

Choose the FSM.


...Well, that's exactly the problem, I do have target object assigned. I created an object first and store it in temp and then set the FSM value of that temp object.



I created the Bullet prefab object with 2 FSM in it but they are not shown in the FSM dropdown box
« Last Edit: June 11, 2013, 10:35:35 AM by ryf9059 »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2494
  • Mender of the past
    • View Profile
    • Cleverous
Re: Cannot set FSM variables stored in an object
« Reply #7 on: June 11, 2013, 10:46:32 AM »
Because that dropdown is looking for a Variable.

You can assign it in 3 ways: Toggle to the part with the text field and up/down arrow button - you can here either 1. type the fsm manually or 2. click the new button to choose the FSM from a list.

Toggle again and it gives you 3. a list of strings, you could use a string variable to store the name if you needed to.

If there are no FSM's in the #2. option then make sure you have an object targetted and that it is not an empty gameObject variable you're filling at during runtime. If it is then you have to manually type it in.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2494
  • Mender of the past
    • View Profile
    • Cleverous
Re: Cannot set FSM variables stored in an object
« Reply #8 on: June 11, 2013, 10:59:23 AM »
'doh just read over it again and it hit me, the problem is in the end of the post above but its this:

You're telling it to Create a new object from a Prefab, then store it in a variable. That happens at runtime. So at editor time the 'temp' variable is actually empty. Just manually type in the data.

ryf9059

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: Cannot set FSM variables stored in an object
« Reply #9 on: June 11, 2013, 11:19:02 AM »
You're telling it to Create a new object from a Prefab, then store it in a variable. That happens at runtime. So at editor time the 'temp' variable is actually empty. Just manually type in the data.

Oh okay now I understand, for things happen at runtime I need to manually set the FSM. Thanks!