# Logic Player

A component for playing Logic Asset.

## How to add

### Add to existing GameObject

1. Select the GameObject you want to add in the Hierarchy window.
2. Click the “Add Component” button in the Inspector window.
3. Select Logic Toolkit > Logic Player from the menu.

### Creating GameObject with Logic Player

1. Click the “+” button in the Hierarchy window.
2. Select Logic Toolkit > Logic Player from the menu.
3. The GameObject will enter name input mode, so enter the name.
4. Confirm with `Enter key`.

## How to use

### Logic Asset Settings

First, you need to set up the Logic Asset you want to run.

1. In the Inspector window, select the Logic Asset you want to use for the Asset property.
   You can also create a new one by clicking the “Create” button.

### Setting initial values ​​for variables

You can set initial values ​​for each variable on the root Blackboard of a Logic Asset.

1. Create a variable in the Blackboard of the Logic Asset beforehand.
2. In the Inspector window, click the “+” button for Variables/Variable Overides.
3. Select the variable you want to set from the menu.
4. Edit the value of the added variable.

### Registering a Variable Override Asset

The initial value of each variable can also be set in Variable Override Asset.

1. In the Inspector window, click the “+” button for Variables/Variable Override Assets.
2. Select the asset you want to register from the menu.
   You can also create a new Variable Override Asset and register it by selecting <Create> from the menu.

When overriding the same variable, the following order is used, and the first value set is applied.

1. Variable Overrides settings
2. Registration order of Variable Override Assets

### Setting up a custom event

Custom events allow you to call events between graphs.

In the Logic Player Inspector, you can view and edit custom events defined in a Logic Asset set in Asset.

For details, see Custom Events.

## Properties

Properties | Description
--- | ---
Edit button | Open Logic Editor window
Auto Play Mode | Mode to start playing automatically None Do not start playing automatically Play On Awake Start playing when the GameObject is awake Play On Start Start playing at the Start of the GameObject
Debug Graph Settings | Graph debug settings Max Loop Count Maximum number of iterations to determine infinite loop Enable Logging Enable debug logging Enable Break Enable debug break
Asset | Play Logic Asset
Variables | Initial value settings for the root Blackboard of Logic Asset
Events | Defining a Custom Event