Implement Variations

Learn how to set up Elecular with Unity and implement different variations of your game.

Unity Setup

Download our Unity package and import it into your project. Once this package is imported, it will automatically create a settings file under Resources/Elecular/Settings.

Then get your Elecular Project ID by logging into app.elecular.com. Once logged in, click the profile icon on the top-right corner and click Show Project ID. You can enter this id into the settings files in Unity.

Create an experiment in Unity by selecting Assets -> Create -> Elecular -> Experiment in the menubar at the top. This will create an Experiment file in your current folder. Select this file and enter the name of the experiment you just created.

Implementing Variations

Elecular provides many "Elecular Components" that will help you add variations without any coding. In this example, we will add a green variation to a button using an ElecularButton component.

Start by adding an ElecularButton component to your button game object. Then, drag the experiment you just created into the component. Now you will be able to see all the variations of the experiment.

You will notice in the image above that I am currently assigned to Variation 1. Do not worry if this is different for you. Each user is deterministically assigned to a random variation. I happen to be assigned to Variation 1 whereas you might be assigned to Control Group. When you release your game, each player will automatically be assigned to a random variation.

To develop and test your button for a specific variation, you need to forcefully assign yourself to a variation by going to the experiment file, clicking on the SetVariation checkbox, and selecting a variation.

Look at the Components section to see other components available in our Unity package. In some situations, you will have your scripts that cannot be used with the provided Elecular Components. In these cases, you can use the Experiment API to easily get the assigned variation and modify your behavior as needed.

Last updated

Was this helpful?