April
27
2015

Learn more about application machines and what you can use them for.

Application machines are Unity components that are added to game objects. They’re mostly used for reacting to application state changes, e.g. when losing focus or pausing the application/game.

An application machine component can be added through the components menu (Makinom > Machines > Application Machine) or the scene wizard (Add Machine > Application Machine). A game object with an application machine is represented in the Unity scene view by this gizmo icon:

ApplicationMachineComponent Icon

You can learn more about machine components in general and their basic settings in this how-to.

Start Types

An application machine is started by application callback functions.

Focus Gained

Started when the application is focused. It’s implemented in the component’s OnApplicationFocus function.

Example

This start type can be used to remove a HUD that was displayed due to losing focus. Use a Call HUD node can also be used to close a HUD.

Focus Lost

Started when the application loses focus (e.g. the player clicks outside the application). It’s implemented in the component’s OnApplicationFocus function.

Example

This start type can be used to display a HUD to show the application is unfocused. Use a Call HUD node to display a HUD.

Paused

Started when the application is paused. It’s implemented in the component’s OnApplicationPause function.

Example

This start type can be used to set the time scale to 0 while the game is paused. Use a Change Time Scale node to change the time scale.

Unpaused

Started when the application resumes playing (i.e. unpaused). It’s implemented in the component’s OnApplicationPause function.

Example

This start type can be used to set the reset the time scale to 1 when continuing to play. Use a Change Time Scale node to change the time scale.

Quit

Started before the application is closed. It’s implemented in the component’s OnApplicationQuit function.

Example

This start type can be used to auto save the game before the application is closed. Use an Auto Save node to save the game to an auto save slot.