static void init()
    {
        Scenes scene_info = new Scenes();

        // Iterate through all scenes and calculate all relations.
        int i;

        for (i = 0; i < scene_info.SceneList.Count; i++)
        {
            MyScene next_scene = scene_info.SceneList[i];

            next_scene.open_set_active();


            calculate_all_relations();
        }
        // calculate_all_relations();

        Debug.Log("Calculating geometric features done");
    }
    /// <summary>
    /// Once measures have been written, resets scene, a new scene is opened and feature extraction
    /// runs again.
    /// </summary>
    /// <remarks>
    /// Called each time scene is re/loaded.
    /// </remarks>
    static void Update()
    {
        if (written && !EditorApplication.isPlaying)
        {
            Debug.Log("passed");
            //Set bool to false
            written = false;
            // Clear scene specific lists
            obj_height_dictionary.Clear();
            ground_list.Clear();

            // Prepare object physics for game.
            foreach (MeshObject obj in meshObjects)
            {
                obj.prepare_physics_for_game();
            }

            // Get scene index from file.
            using (StreamReader file = new StreamReader(scene_index_file)){
                string line = file.ReadLine();
                if (line == null)
                {
                    scene_index = 0;
                }
                else
                {
                    scene_index = int.Parse(line.Split(',')[0]);
                }

                Debug.Log("Scene Index:");
                Debug.Log(scene_index);
            }

            // Rewrite csv with new index.
            using (StreamWriter filen = new StreamWriter(scene_index_file)){
                List <String> row = new List <String>();
                int           n   = scene_index + 1;
                row.Add(n.ToString());

                string[] row1           = row.ToArray();
                string   row_csv_string = String.Join(",", row1);
                filen.WriteLine(row_csv_string);
            }

            // Get next scene.
            Scenes scene_info = new Scenes();
            foreach (MyScene s in scene_info.SceneList)
            {
                scene_list.Add(s);
            }
            MyScene next_scene = scene_list[scene_index];
            //load new scene and then call init
            Debug.Log("Next Scene:");
            Debug.Log(next_scene.path);

            // Open next scene.
            next_scene.open_set_active();

            // Run main.
            main();
        }
    }