Event handlers have their own scope as regular functions do. I'm almost certain of this, because you can call, in example, the code inside "on button pressed" event like a function, with button.pressed(). But he declared the variable holding the pointer to the Sphere in macroScript scope, resolving the event scope issue.…