Skip to main content

Creating Your Own Settings

namespace: qASIC.Options

Introduction

Custom settings allow your users to have more control over your game.

note

Currently there is only one way of adding custom settings. This is going to change in the future.

Creating custom settings

To create a custom setting add the Options Setting attribute to a method that will handle it.

//Setting of name 'sensitivity' with the default value of '1'
[OptionsSetting("sensitivity", 1f)]
public static void ChangeSensitivity(float value)
{
sensitivity = value;
}
tip

It is recomended to specify a default value in order to automatically set the Menu Option, but it isn't necessary. Alternatively, you can setup a custom hook:

[OptionsSetting("sensitivity", defaultValueMethodName = nameof(GetDefaultSensitivity))]
public static void ChangeSensitivity(float value)
{
sensitivity = value;
}

public static float GetDefaultSensitivity()
{
//This is where you get the default value
return 1f;
}

Now you can easily reference it in a Menu Option by specifying it's name.