/// <summary>
    /// Load the effects before playing
    /// </summary>
    public void Load()
    {
        //Debug.Log("Load:");

        if (_mIsLoaded)
        {
            //Debug.LogError("Animation has already been loaded!");
            return;
        }

        if (ChromaConnectionManager.Instance.Connected)
        {
            //Debug.Log(string.Format("Create {0} Frames.", Frames.Count));
            for (int i = 0; i < Frames.Count; ++i)
            {
                EffectArray2dInput frame = Frames[i];
                //Debug.Log("Create Effect.");
                EffectResponseId effect = ChromaUtils.CreateEffectCustom2D(Device, frame);

                /*
                 * // app can check the effect list for null or non-zero result
                 * if (null == effect ||
                 *  effect.Result != 0)
                 * {
                 *  Debug.LogError("Failed to create effect!");
                 * }
                 */
                _mEffects.Add(effect);
            }

            _mIsLoaded = true;
        }
    }
 public void Load()
 {
     if (this._mIsLoaded)
     {
         Debug.LogError("Animation has already been loaded!");
         return;
     }
     if (ChromaConnectionManager.Instance.Connected)
     {
         for (int i = 0; i < this.Frames.Count; i++)
         {
             EffectArray2dInput input = this.Frames[i];
             EffectResponseId   item  = ChromaUtils.CreateEffectCustom2D(this.Device, input);
             this._mEffects.Add(item);
         }
         this._mIsLoaded = true;
     }
 }
    protected override void OnClickPreviewButton()
    {
        ChromaSDKAnimation2D animation = GetAnimation();

        EditorUtility.SetDirty(animation);
        var frames = animation.Frames; //copy

        Unload();

        if (_mCurrentFrame >= 0 &&
            _mCurrentFrame < frames.Count)
        {
            ChromaDevice2DEnum device = animation.Device;
            EffectArray2dInput colors = frames[_mCurrentFrame];
            EffectResponseId   effect = ChromaUtils.CreateEffectCustom2D(device, colors);
            if (null != effect &&
                effect.Result == 0)
            {
                ChromaUtils.SetEffect(effect.Id);
                ChromaUtils.RemoveEffect(effect.Id);
            }
        }
    }