Skip to content

Experiment Manager

Samuel Knox edited this page Jan 6, 2021 · 6 revisions

The Experiment Manager is a tool that can be used with any script and will change independent variables and record dependent variables.

Quickstart

  1. Add the experiment manager script to any gameObject
  2. Select the target script with independent and dependent variables
  3. Select variables from drop-down menus and method of data collection
  4. Set the final variables

You MUST have a ResetExperiment which takes Dict<string, float> as the sole argument in your target script. An example is below:

public void ResetExperiment(Dictionary<string, float> dict)
{
    // Set variables - CRUCIAL
    foreach (var kvp in dict)
    {
        GetType().GetField(kvp.Key).SetValue(this, kvp.Value);
    }
    
    // Destroy agents
    var agents = GameObject.FindGameObjectsWithTag("UAV");
    foreach (var agent in agents)
    {
        DestroyImmediate(agent);
    }
    
    //Reset variables
    Density = 0f;
}

Experiment variables

  • Experiment Time - Takes time in seconds
  • Directory - Takes path to save directory (Tip: Go to the directory you want the file in, right-click and select copy path)
  • File Name - Takes file name with no extension (All files are .csv)