playMaker

Author Topic: When to use variables, events and globals.  (Read 2280 times)

Amy

  • Playmaker Newbie
  • *
  • Posts: 36
When to use variables, events and globals.
« on: May 02, 2012, 07:27:04 PM »
I'm having a bit of trouble understanding variable differences. I understand Int is a number, String is text and gameobject effects the gameobject but WHEN to use them or events is always confusing and feels like guess work. Is there any person who can do a one or two sentence explanation of what each variable (or global events) is best utilized being used for?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3998
  • Official Playmaker Support
    • LinkedIn
Re: When to use variables, events and globals.
« Reply #1 on: May 02, 2012, 07:55:15 PM »
I'll try to beef up the docs for this. But in the meantime, here's a quick summary:

Variable Types:

  • String - Text
  • Int - Integer or whole number (1,2,3...)
  • Float - Floating point number (0.5, 1.2...)
  • Bool - True or False. Useful to store the results of a test.
  • Vector3 - Three Floats: x, y, and z. Typically used to store position or rotation.
  • GameObject - A reference to a GameObject in the scene/project.
  • Rect - Defines a rectangle using four floats: x, y, width, height.
  • Material - Stores a reference to a Material in the project.
  • Texture - Stores a reference to a Texture in the project.
  • Color - Stores a color.
  • Quaternion - An advanced representation of a rotation. Sometimes actions will use this for better interpolation between 2 rotations.
  • Object - Any type of UnityEngine.Object. This lets you reference all sorts of properties in Unity. It's also pretty advanced. We'll make some tutorials for this soon.

TIP: Rollover a parameter in an Action to see its Type. This will tell you what type of variable to make.

Global Events: If you want to send events between FSMs they must be marked Global.

Global Variables: If you want to easily access a variable from any FSM, make a global variable (e.g., NumberOfLives, Score, PlayerName...)

Hope this helps some!

Amy

  • Playmaker Newbie
  • *
  • Posts: 36
Re: When to use variables, events and globals.
« Reply #2 on: May 03, 2012, 03:51:45 PM »
While helpful, I think beefier explanations into the documents would be most appreciated <3