Creating Your First Effect
The Crowd Control Effect Loader Script
Adding and Modifying the Effect Loader Script
The Crowd Control Effect Loader is responsible for loading and initializing the effects that will be used in your game. To locate the script:
- Create a new empty GameObject in your scene and name it something descriptive, like "Crowd Control Effect Loader".
- Optional but recommended: Place the GameObject as a child of the Crowd Control Manager GameObject.
- Click on the newly created GameObject and go to the inspector. Click on "Add Component" and search for "UnityEffectLoader". Add the script to the GameObject.
To create an effect that performs a single immediate action when a stream viewer activates it:
- Create a new script that inherits from CrowdControl.Client.Unity.UnityEffectBase (see details below).
- Create a new empty GameObject in your scene and name it as-appropriate for the effect (e.g. "Force Player Jump").
- Place the GameObject as a child of the Crowd Control Effect Loader GameObject.
- Click on the newly created GameObject and go to the inspector. Click on "Add Component" and search for your newly-created effect script. Add the script to the GameObject.
- Observe the inspector and you will see the effect script's fields that you can modify.

Effect ID
The ID for your effect is a unique identifier that is not displayed to viewers, but is used in the backend to link the effect in your game to the effect on the Crowd Control extension and website. This value can be any alphanumeric string, but it is recommended to use a descriptive name that gives an idea of what the effect does. For example, if your effect makes the player jump, you could use "jump" as the Effect ID. This will make it easier for you to keep track of your effects and for viewers to understand what the effect does when they see it on the Crowd Control extension and website.
Name
The name of your effect is what viewers will see on the Crowd Control website when they are looking at the list of effects they can activate. This should be a descriptive name that gives viewers an idea of what the effect does.
Description
A description of your effect that gives viewers more details about what the effect does. This is also displayed on the Crowd Control extension and website.
Default Price
The default price of an effect is the amount of Crowd Control coins that a viewer must spend to activate the effect. This is displayed on the Crowd Control extension and website so that viewers know how much it will cost to activate the effect.
Conflicts
The conflicts field is a list of effect IDs that cannot be active at the same time as this effect. If a viewer tries to activate an effect that conflicts with an already active effect, the effect will be queued until the conflicting effect is no longer active. This is useful for effects that would interfere with each other or cause undesirable gameplay if they were active at the same time.
Morality
Represents the moral alignment of an effect. For game purposes, use a utilitarian definition, defining the morality of an action as the degree to which it is helpful or harmful to the player.
Orderliness
Represents the order alignment of an effect. For game purposes, orderliness is defined as how predictably the effect influences gameplay.
Default Duration
The default duration of an effect is the amount of time that the effect will be active for when a viewer activates it. This value should be zero for effects that have an instantaneous effect and do not require a duration. If an effect does have a duration, it will be displayed on the Crowd Control extension and website so that viewers know how long the effect will last. This field is editable by the streamer, so it can be modified to be longer or shorter than the default duration if desired.
Max Quantity
If your effect has a quantity parameter, the max quantity field is the maximum amount of that parameter that a viewer can specify when activating the effect. Setting this parameter to a value greater than 1 allows viewers to specify a quantity when activating the effect, which can be used to scale the effect's impact or price based on the quantity specified by the viewer.
Parameters
Parameters are additional values that viewers can specify when activating an effect to customize the effect's behavior. See the "Creating a Parameterized Effect" section for more details on parameters and how to use them in your effects.
The Effect Script
Every effect must have a script that defines the functionality of the effect. This script must inherit from CrowdControl.Client.Unity.UnityEffectBase. The name of the class does not matter, but it is recommended to name it the same as the Effect ID.
using CrowdControl.Client.Unity;
using CrowdControl.Common;
using UnityEngine;
namespace Assets.Scripts.Crowd_Control.Effects
{
internal class ExampleEffect : UnityEffectBase
{
public override EffectStatus StartEffect(EffectRequest request)
{
Debug.Log("ExampleEffect started...");
return EffectStatus.Success;
}
}
}The StartEffect Function
The StartEffect is a function that is responsible for activating the desired functionality when a request for this effect is received. This function should implement all the basic functionality for activating an effect.
StartEffect must return an EffectStatus. This is sent back to the Crowd Control server to inform it of how the game handled the state. The following EffectResult types are:
- EffectStatus.Success: The effect was triggered successfully.
- EffectStatus.FailTemporary: The game was unable to execute the effect at this moment. The effect is reinserted into the back of the effect queue and retried at a later time. This is the desired non-success state in most cases.
- EffectStatus.FailPermanent: The effect is no longer available for execution for the remainder of the play session. It will be removed from the player's list of available effects and will not be retried. This should be used for effects that can only be used once per play session, or for effects that are permanently no longer relevant due to changes in the game state.
