When a boolean becomes true, I want to add a behavior to an object. For example, I want to click on a checkbox which activates a boolean, then adds a drag&drop behavior to an object.
Is this possible, and if so, How?
Develop games in your browser. Powerful, performant & highly capable.
Behaviors have an enabled property. All you need to do is, set the initially enabled to false. Then you can use an action to set it enabled or disabled depending on the value of your checkbox. You don't even need the boolean.
Thanks, that was simpler than I expected.