Example #1
0
    public void inicializarTargets()
    {
        string dataJson = File.ReadAllText(filePath);

        Debug.Log("Cargado JSON: " + dataJson);
        txt.text = "Cargado JSON";
        targets  = TargetCollection.FromJSON(dataJson);
        Debug.Log(targets.SaveToString());
        VideoPlayer[] videos = FindObjectsOfType <VideoPlayer>();
        foreach (VideoPlayer v in videos)
        {
            Debug.Log(v.gameObject.name);
            Debug.Log("Root de video: " + v.transform.root.name);
            DataTarget dataTarget = targets.buscarTarget(v.gameObject.transform.root.name);
            if (dataTarget != null)
            {
                v.url = dataTarget.urlVideo;
                StartCoroutine(prepareVideo(v));
            }
        }
        AudioSource[] audios = FindObjectsOfType <AudioSource>();
        foreach (AudioSource a in audios)
        {
            StartCoroutine(GetAudioClip(a));
        }
    }