Play’s Expression Editor is an input method that allows you to create more advanced, custom interactions. It can be accessed by clicking the + sign button on any property of any interaction node.When you press the + icon, the Expression Editor will appear as a new window. In the top left, you’ll see the name of the interaction node (i.e. Set State, Animate, etc.) and the property name (i.e. Value, Start, etc.).The majority of the Expression Editor will resemble a code editor. This is where you’ll write your expression.Keeping an Expression Editor OpenUsually, an Expression Editor window will be dismissed when you press Enter or click on another node/object. You can keep an Expression Editor open AND pin it to a specific location by dragging it into the desired position. Any number of Expression Editors can be open at once. You can close a pinned Expression Editor by clicking the pin/close button in its top left corner.
A boolean is a data type that has a value of either true or false.If you wrote…
Copy
Ask AI
"Hello" == "Hello"
The Expression Editor’s output would be a bool with the value True because these strings are the same.If you instead wrote…
Copy
Ask AI
"Hello" == "Goodbye"
The Expression Editor’s output would be a bool with a value False because these strings are not equivalent.If we used numbers instead of strings, we would see 0 or 1 instead of false or true, respectively.For example, if you wrote…
Copy
Ask AI
1 == 1
The Expression Editor’s output would be a bool with the value 1 because it’s true that one equals one.
You’ll use the Expression Editor for functions, equations, and using object, device, and trigger properties. You can read more about each section by clicking on the links above.