void Start() { GameObject gameState = GameObject.Find("GameState"); GameState gs = gameState.GetComponent <GameState>(); fileName = gs.fileName; String newPath = Path.Combine("StreamingAssets", fileName); // Get Path to file in resources folder without .json ! String savedString = JsonTestClass.LoadJSONFromFile(newPath); // Load Json from file musicFile = new JsonTestClass.MusicalFile(); musicFile = JsonTestClass.JSONToObject(savedString); // Create Object from Json numberNote = musicFile.numberNote; partition = new List <KeyValuePair <NoteScript, float> >(); for (int i = 0; i < numberNote; i++) { int clipIndex = musicFile.musicalNote[i].noteName + 12 * musicFile.musicalNote[i].noteOctave; float clipDuration = musicFile.musicalNote[i].noteTempo; if (clipIndex < 84) { partition.Add(new KeyValuePair <NoteScript, float> (notes [clipIndex].GetComponent <NoteScript> (), clipDuration)); } else { partition.Add(new KeyValuePair <NoteScript, float> (null, clipDuration)); } } // Play(); }