public void AddFrames(SVGAsset[] assets)
        {
            Undo.RecordObject(target, "Add Frames");
            SVGFrameAnimator frameAnimator = target as SVGFrameAnimator;

            if (frameAnimator == null)
            {
                return;
            }
            if (frameAnimator.frames == null || frameAnimator.frames.Length == 0)
            {
                frameAnimator.frames = (SVGAsset[])assets.Clone();
            }
            else
            {
                int start = frameAnimator.frames.Length;
                int end   = frameAnimator.frames.Length + assets.Length;
                System.Array.Resize <SVGAsset>(ref frameAnimator.frames, frameAnimator.frames.Length + assets.Length);
                for (int i = start; i < end; i++)
                {
                    frameAnimator.frames[i] = assets[i - start];
                }
            }
            EditorUtility.SetDirty(target);
        }
示例#2
0
 public static GameObject DropFramesToSceneToCreateGO(string name, SVGAsset[] frames, Vector3 position)
 {
     if (frames.Length > 0)
     {
         SVGAsset   asset      = frames[0];
         GameObject gameObject = DropSVGAssetToSceneToCreateGO(asset, position);
         if (frames.Length > 1)
         {
             SVGFrameAnimator svgFrameAnimator = gameObject.AddComponent <SVGFrameAnimator>();
             svgFrameAnimator.frames = frames.Clone() as SVGAsset[];
         }
         return(gameObject);
     }
     return(null);
 }