February
01
2014

You can use any control you like with ORK Framework – you just need to let ORK know.

ORK Framework’s built in controls are a good starting point to get you going, but most likely you’ll want to add your own control scripts for player or camera control. Since ORK needs to enable/disable control at certain points in a game (e.g. during a cut-scene event or a battle without direct player control), you need to set up the name of your control scripts on the player or camera, to allow ORK accessing it.

The game controls are set up in the ORK Framework editor in Base/Controls > Game Controls. To set up the player or camera controls for using custom controls, change the following settings.

  • Control Type
    Select None.

Now, click on Add Custom Control in the Custom Control settings to add information about your custom control script.

  • Blocked By
    Select if the control script is blocked with the Player or Camera controls.
  • Placed On
    Select if the control script is placed on the Player or Camera.
  • Behaviour Name
    Set it to the name of your script.
    E.g. your script’s name is CustomControl.cs (and the name of the class is CustomControl), you need to set the name to CustomControl.
  • Add Component
    If your control script is already added to your player/camera, disable this setting.
    If you want ORK Framework to automatically add the script to the player/camera, enable this setting.

And that’s it – there are additional settings for control scripts that are placed on child objects of the player/camera, and you can set initial fields and parameters of the script.

howto_custom_controls1

Wrapper Components

In case your control component needs some kind of special treatment or setup that doesn’t work well with ORK’s custom control setup, consider writing a wrapper component.

A wrapper component works as a bridge between ORK and your custom control. You’d define the wrapper component in ORK’s custom control and manage blocking and unblocking the custom control in your wrapper component.

When ORK blocks a control, the component will be disabled, so you’ll use the OnDisable function of the component:

When ORK unblocks a control, the component will be enabled, so you’ll use the OnEnable function of the component:

You can also add these functions to your actual custom control component and skip using a wrapper component.