Scritping

Screen Shot 2016-04-13 at 17.28.47

Multi-Faders are the first of several planned scripting features.

Multi-Fader workflow:
1. Press the button [Add Multi-Fader], this will add a new fader. You can add how many faders you like. Note that there may be a performance impact for using excessive amounts of faders.

2. Each fader can own a collection of Linked Parameters. Press the button [Add Linked Parameter] to add a new parameter.

3. Now you can choose what parameter to link by selecting a custom effect and then what parameter to modify.

4. A good way to work is to set the Multi-Fader to 100% when you’re tweaking, otherwise you will not see the results of your tweaks. When you’re done tweaking, you can set the Multi-Fader back to 0%.

5. In your script use the following code to access the RetroDeluxeCRT effect:

private RetroDeluxeCRT.CRTImageEffect crtEffect;
void Start () {
    crtEffect = this.GetComponent<RetroDeluxeCRT.CRTImageEffect> ();
}

Use something like this to modify the value of a Multi-Fader:

crtEffect.Scripting_SetMultiFader(RetroDeluxeCRT.MultiFaderIndex.A, [insert your value here, 0.0f - 1.0f], true);

or:

// The following code will make Fader A move like a sine wave between 0.2 and 0.6
crtEffect.Scripting_SetMultiFader(RetroDeluxeCRT.MultiFaderIndex.A, 0.4f + 0.2f * Mathf.Sin(Time.realtimeSinceStartup * 3.0f % (Mathf.PI * 2.0f)), true);

Note: If you set the third parameter to true, the effect will warn you if you try to access a Multi-Fader that does not exist in the current preset. Sometimes one might want to disable warnings, such as when switching a lot between presets and assuming faders are there. For example, Fader A might always be the effect for when the player character is hurt.

Comments are closed.