public override void Copy(SpriteRoot s)
    {
        base.Copy(s);
        if (!(s is AutoSpriteBase))
        {
            return;
        }
        AutoSpriteBase autoSpriteBase = (AutoSpriteBase)s;

        if (autoSpriteBase.spriteMesh != null)
        {
            if (autoSpriteBase.animations.Length > 0)
            {
                this.animations = new UVAnimation[autoSpriteBase.animations.Length];
                for (int i = 0; i < this.animations.Length; i++)
                {
                    this.animations[i] = autoSpriteBase.animations[i].Clone();
                }
            }
        }
        else if (this.States != null)
        {
            this.animations = new UVAnimation[autoSpriteBase.States.Length];
            for (int j = 0; j < autoSpriteBase.States.Length; j++)
            {
                this.animations[j] = new UVAnimation();
                this.animations[j].SetAnim(autoSpriteBase.States[j], j);
            }
        }
    }
    public virtual void CopyAll(SpriteRoot s)
    {
        base.Copy(s);
        if (!(s is AutoSpriteBase))
        {
            return;
        }
        AutoSpriteBase autoSpriteBase = (AutoSpriteBase)s;

        this.States = new TextureAnim[autoSpriteBase.States.Length];
        for (int i = 0; i < this.States.Length; i++)
        {
            this.States[i] = new TextureAnim();
            this.States[i].Copy(autoSpriteBase.States[i]);
        }
        this.animations = new UVAnimation[this.States.Length];
        for (int j = 0; j < this.States.Length; j++)
        {
            this.animations[j] = new UVAnimation();
            this.animations[j].SetAnim(this.States[j], j);
        }
    }
	public void SetupSelection()
	{
		bool somethingChanged = false;

		// See if something changed:
		if (sprite != null)
		{
			if (sprite.gameObject != Selection.activeGameObject)
				somethingChanged = true;
			else if (sprite.States.Length != animList.Length)
				somethingChanged = true;
			else if (sprite.States.Length < 1)
				somethingChanged = true;
			else if (selectedAnim >= sprite.States.Length || selectedAnim < 0)
				somethingChanged = true;
			else if (sprite.States[selectedAnim].frameGUIDs.Length != frames.Count)
				somethingChanged = true;
		}
		else
			somethingChanged = true;

		if (somethingChanged)
		{
			if (Selection.activeGameObject != null)
			{
				sprite = (AutoSpriteBase)Selection.activeGameObject.GetComponent(typeof(AutoSpriteBase));
				selGO = Selection.activeGameObject;
				zoomCoef = 1f;
			}
			else
			{
				// If another GameObject wasn't selected,
				// don't change anything so we can drag
				// textures in, etc.
				// So only change if there is no activeObject
				// (as opposed to activeGameObject):
				if(Selection.activeObject == null)
				{
					selGO = null;
					sprite = null;
				}
			}

			// Select a safe value for our selected frame:
			if (sprite != null)
			{
				if (sprite.States.Length > 0)
				{
					selectedAnim = Mathf.Clamp(selectedAnim, 0, sprite.States.Length - 1);
					animSettingsTracker.Synch(sprite.States[selectedAnim]);
				}

				// Commented out because two different sprites with
				// the same number of frames in their selected anim
				// would cause the list not to be updated:
				//if (sprite.States.Length != animList.Length)
				BuildAnimList();

				if (sprite.States.Length > 0)
				{
					selectedAnim = Mathf.Clamp(selectedAnim, 0, sprite.States.Length - 1);
					if (sprite.States[selectedAnim].frameGUIDs.Length != frames.Count)
						RebuildFrameList();

					// Only change the selected frame if it is not valid:
					if (selectedFrame != null)
						if (selectedFrame.index >= sprite.States[selectedAnim].frameGUIDs.Length)
						{
							selectedFrame = null;
						}
				}
				else
					selectedFrame = null;
			}
			else
			{
				selectedFrame = null;
			}

			if (m_editor != null)
				m_editor.Repaint();
		}
	}