public static int EaseIndex(LeanTweenItem item)
        {
            if (item.easeStr.Length <= 0)
            { // First Time setup
                item.easeStr = easeStrMapping[(int)item.ease];
                if (item.ease == LeanTweenType.NotUsed)
                {
                    item.easeStr = "linear";
                }
            }
            int easeIndex = -1; // easeIndex( item )

            for (int j = 0; j < easeStrMapping.Length; j++)
            {
                if (item.easeStr == easeStrMapping[j])
                {
                    easeIndex = j;
                    // Debug.Log("found match easeIndex:"+easeIndex + " easeStrMapping[easeIndex]:"+easeStrMapping[easeIndex]);
                    break;
                }
            }
            if (easeIndex < 0) // nothing found set to intial
            {
                easeIndex = 0;
            }
            return(easeIndex);
        }
Example #2
0
 // Instantiates LeanTweenGroup by making a copy of group.
 // <param name="group">Group.</param>
 public LeanTweenItem(LeanTweenItem item)
 {
     itemName  = item.itemName;
     action    = item.action;
     recursive = item.recursive;
     between   = item.between;
     ease      = item.ease;
     from      = item.from;
     to        = item.to;
     axis      = item.axis;
     duration  = item.duration;
     delay     = item.delay;
     loopDelay = item.loopDelay;
     foldout   = item.foldout;
 }
        public static int actionIndex(LeanTweenItem item)
        {
            int actionIndex = -1;

            for (int j = 0; j < methodStrMapping.Length; j++)
            {
                if (item.actionStr == methodStrMapping[j])
                {
                    actionIndex = j;
                    // Debug.Log("found match actionIndex:"+actionIndex + " methodStrMapping[actionIndex]:"+methodStrMapping[actionIndex]);
                    break;
                }
            }
            if (actionIndex < 0) // nothing found set to intial
            {
                actionIndex = 0;
            }
            return(actionIndex);
        }
Example #4
0
        /// <summary>
        /// Use to get a item end time with counting item repeats
        /// </summary>
        public float GetItemTotalTime(LeanTweenItem item)
        {
            int   loopCount = 1;
            float loopDelay = 0;

            if (item.doesLoop)
            {
                loopDelay = item.loopDelay;
                if (item.loopCount < 1)
                {
                    loopCount = defaultLoopCount;
                }
                else
                {
                    loopCount = item.loopCount;
                }
            }

            return((item.duration * loopCount) + (loopDelay * (loopCount - 1)) + item.delay);
        }
Example #5
0
        private void BuildTween(LeanTweenItem item, float delayAdd, bool generateCode, bool resetPath)
        {
            item.recursive = false; // Don't use recursive
            float delay = item.delay + delayAdd;
            bool  code  = generateCode;
            float d     = item.duration;

            if (isSimulating)
            {
                code = false;
                if (item.loopCount < 1)
                {
                    item.loopCount = defaultLoopCount;
                    itensWithInfiniteLoops.Add(item);
                }
            }

            if (item.actionStr == null)
            {
                item.actionStr = "Move";
            }
            item.action = (TweenAction)Enum.Parse(typeof(TweenAction), item.actionStr, true);

            // Debug.Log("item.gameObject:"+item.gameObject+" name:"+item.gameObject.transform.name);
            if (item.gameObject == null)
            {
                item.gameObject = gameObject;
            }

            switch (item.action)
            {
            case TweenAction.Move:
                tween = code ? Append("Move", item.to, d) : LeanTween.move(item.gameObject, item.to, d);
                break;

            case TweenAction.MoveX:
                tween = code ? Append("MoveX", item.to.x, d) : LeanTween.MoveX(item.gameObject, item.to.x, d);
                break;

            case TweenAction.MoveY:
                tween = code ? Append("MoveY", item.to.x, d) : LeanTween.moveY(item.gameObject, item.to.x, d);
                break;

            case TweenAction.MoveZ:
                tween = code ? Append("MoveZ", item.to.x, d) : LeanTween.moveZ(item.gameObject, item.to.x, d);
                break;

            case TweenAction.MoveLocal:
                tween = code ? Append("MoveLocal", item.to, d) : LeanTween.moveLocal(item.gameObject, item.to, d);
                break;

            case TweenAction.MoveLocalX:
                tween = code ? Append("MoveLocalX", item.to.x, d) : LeanTween.MoveLocalX(item.gameObject, item.to.x, d);
                break;

            case TweenAction.MoveLocalY:
                tween = code ? Append("MoveLocalY", item.to.x, d) : LeanTween.MoveLocalY(item.gameObject, item.to.x, d);
                break;

            case TweenAction.MoveLocalZ:
                tween = code ? Append("MoveLocalZ", item.to.x, d) : LeanTween.MoveLocalZ(item.gameObject, item.to.x, d);
                break;

            case TweenAction.MoveAdd:
                tween = code ? Append("MoveAdd", item.to, d) : LeanTween.MoveAdd(item.gameObject, item.to, d);
                break;

            case TweenAction.MoveBezier:
                tween = code ? append("Move", item.bezierPath ? item.bezierPath.vec3 : null, d) : LeanTween.Move(item.gameObject, item.bezierPath, d, resetPath);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".SetOrientToPath(" + item.orientToPath.ToString().ToLower() + ")");
                    }
                    else
                    {
                        tween.SetOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".SetOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
                break;

            case TweenAction.MoveBezierLocal:
                tween = code ? append("MoveLocal", item.bezierPath ? item.bezierPath.vec3 : null, d) : LeanTween.MoveLocal(item.gameObject, item.bezierPath, d, resetPath, item.alignToPath);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".SetOrientToPath(" + item.orientToPath + ")");
                    }
                    else
                    {
                        tween.SetOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".SetOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
                break;

            case TweenAction.MoveSpline:
                tween = code ? append("MoveSpline", item.splinePath ? item.splinePath.splineVector() : null, d) : LeanTween.MoveSpline(item.gameObject, item.splinePath, d, resetPath);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".SetOrientToPath(" + item.orientToPath + ")");
                    }
                    else
                    {
                        tween.SetOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".SetOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
                break;

            case TweenAction.MoveSplineLocal:
                tween = code ? append("MoveSplineLocal", item.splinePath ? item.splinePath.splineVector() : null, d) : LeanTween.MoveSplineLocal(item.gameObject, item.splinePath, d, resetPath, item.alignToPath);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".SetOrientToPath(" + item.orientToPath + ")");
                    }
                    else
                    {
                        tween.SetOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".SetOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
                break;

            case TweenAction.CanvasMove:
                tween = code ? AppendRect("Move", item.to, d) : LeanTween.Move(item.gameObject.GetComponent <RectTransform>(), item.to, d);
                break;

            case TweenAction.CanvasMoveX:
                tween = code ? AppendRect("MoveX", item.to.x, d) : LeanTween.MoveX(item.gameObject.GetComponent <RectTransform>(), item.to.x, d);
                break;

            case TweenAction.CanvasMoveY:
                tween = code ? AppendRect("MoveY", item.to.x, d) : LeanTween.MoveY(item.gameObject.GetComponent <RectTransform>(), item.to.x, d);
                break;

            case TweenAction.CanvasMoveZ:
                tween = code ? AppendRect("MoveZ", item.to.x, d) : LeanTween.MoveZ(item.gameObject.GetComponent <RectTransform>(), item.to.x, d);
                break;

            case TweenAction.CanvasMoveAdd:
                tween = code ? AppendRect("MoveAdd", item.to, d) : LeanTween.MoveAdd(item.gameObject.GetComponent <RectTransform>(), item.to, d);
                break;

            case TweenAction.CanvasMoveBezier:
                tween = code ? AppendRect("Move", item.bezierPath ? item.bezierPath.vec3 : null, d) : LeanTween.Move(item.gameObject.GetComponent <RectTransform>(), item.bezierPath, d, resetPath);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".SetOrientToPath(" + item.orientToPath.ToString().ToLower() + ")");
                    }
                    else
                    {
                        tween.SetOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".SetOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
                break;

            case TweenAction.CanvasMoveBezierLocal:
                tween = code ? AppendRect("MoveLocal", item.bezierPath ? item.bezierPath.vec3 : null, d) : LeanTween.MoveLocal(item.gameObject.GetComponent <RectTransform>(), item.bezierPath, d, resetPath, item.alignToPath);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".SetOrientToPath(" + item.orientToPath + ")");
                    }
                    else
                    {
                        tween.SetOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".SetOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
                break;

            case TweenAction.Rotate:
                tween = code ? Append("Rotate", item.to, d) : LeanTween.Rotate(item.gameObject, item.to, d);
                break;

            case TweenAction.RotateLocal:
                tween = code ? Append("RotateLocal", item.to, d) : LeanTween.RotateLocal(item.gameObject, item.to, d);
                break;

            case TweenAction.RotateX:
                tween = code ? Append("RotateX", item.to.x, d) : LeanTween.RotateX(item.gameObject, item.to.x, d);
                break;

            case TweenAction.RotateY:
                tween = code ? Append("RotateY", item.to.x, d) : LeanTween.RotateY(item.gameObject, item.to.x, d);
                break;

            case TweenAction.RotateZ:
                tween = code ? Append("RotateZ", item.to.x, d) : LeanTween.RotateZ(item.gameObject, item.to.x, d);
                break;

            case TweenAction.RotateAdd:
                tween = code ? Append("RotateAdd", item.to, d) : LeanTween.RotateAdd(item.gameObject, item.to, d);
                break;

            case TweenAction.CanvasRotate:
                tween = code ? AppendRect("Rotate", item.to, d) : LeanTween.Rotate(item.gameObject.GetComponent <RectTransform>(), item.to, d);
                break;

            case TweenAction.CanvasRotateLocal:
                tween = code ? AppendRect("RotateLocal", item.to, d) : LeanTween.RotateLocal(item.gameObject.GetComponent <RectTransform>(), item.to, d);
                break;

            case TweenAction.CanvasRotateAdd:
                tween = code ? AppendRect("RotateAdd", item.to, d) : LeanTween.RotateAdd(item.gameObject.GetComponent <RectTransform>(), item.to, d);
                break;

            case TweenAction.Scale:
                tween = code ? Append("Scale", item.to, d) : LeanTween.Scale(item.gameObject, item.to, d);
                break;

            case TweenAction.ScaleX:
                tween = code ? Append("ScaleX", item.to.x, d) : LeanTween.ScaleX(item.gameObject, item.to.x, d);
                break;

            case TweenAction.ScaleY:
                tween = code ? Append("ScaleY", item.to.x, d) : LeanTween.ScaleY(item.gameObject, item.to.x, d);
                break;

            case TweenAction.ScaleZ:
                tween = code ? Append("ScaleZ", item.to.x, d) : LeanTween.ScaleZ(item.gameObject, item.to.x, d);
                break;

            case TweenAction.ScaleAdd:
                tween = code ? Append("ScaleAdd", item.to, d) : LeanTween.ScaleAdd(item.gameObject, item.to, d);
                break;

            case TweenAction.CanvasScale:
                tween = code ? AppendRect("Scale", item.to, d) : LeanTween.Scale(item.gameObject.GetComponent <RectTransform>(), item.to, d);
                break;

            case TweenAction.CanvasScaleAdd:
                tween = code ? AppendRect("ScaleAdd", item.to, d) : LeanTween.ScaleAdd(item.gameObject.GetComponent <RectTransform>(), item.to, d);
                break;

            case TweenAction.CanvasSize:
                Vector2 to = new Vector2(item.to.x, item.to.y);
                tween = code ? appendRect("Size", to, d) : LeanTween.Size(item.gameObject.GetComponent <RectTransform>(), to, d);
                break;

            case TweenAction.CanvasSizeAdd:
                to    = new Vector2(item.to.x, item.to.y);
                tween = code ? appendRect("SizeAdd", to, d) : LeanTween.SizeAdd(item.gameObject.GetComponent <RectTransform>(), to, d);
                break;

            case TweenAction.Color:
                tween = code ? Append("Color", item.colorTo, d, item.recursive) : LeanTween.Color(item.gameObject, item.colorTo, d, item.recursive);
                break;

            case TweenAction.ColorGroup:
                tween = code ? Append("ColorGroup", item.colorTo, d) : LeanTween.ColorGroup(item.gameObject, item.colorTo, d);
                break;

            case TweenAction.Alpha:
                tween = code ? Append("Alpha", item.to.x, d, item.recursive) : LeanTween.Alpha(item.gameObject, item.to.x, d, item.recursive);
                break;

            case TweenAction.AlphaGroup:
                tween = code ? Append("AlphaGroup", item.to.x, d) : LeanTween.AlphaGroup(item.gameObject, item.to.x, d);
                break;

            case TweenAction.AlphaVertex:
                tween = code ? Append("AlphaVertex", item.to.x, d, item.recursive) : LeanTween.AlphaVertex(item.gameObject, item.to.x, d, item.recursive);
                break;

            case TweenAction.CanvasPlaySprite:
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.Play(GetComponent<RectTransform>(), new UnityEngine.Sprite[" + item.sprites.Length + "]).setFrameRate(" + item.frameRate + "f)");
                }
                else if (item.sprites != null)
                {
                    if (item.sprites.Length > 0)
                    {
                        tween = LeanTween.Play(item.gameObject.GetComponent <RectTransform>(), item.sprites).setFrameRate(item.frameRate);
                    }
                    else
                    {
                        Debug.LogError("Sprite list lenght == 0.");
                        return;
                    }
                }
                else
                {
                    Debug.LogError("Sprite list == null.");
                    return;
                }
                break;

            case TweenAction.CanvasAlpha:
                tween = code ? AppendRect("Alpha", item.to.x, d, item.recursive) : LeanTween.Alpha(item.gameObject.GetComponent <RectTransform>(), item.to.x, d, item.recursive);
                break;

            case TweenAction.CanvasTextAlpha:
                tween = code ? AppendRect("TextAlpha", item.to.x, d, item.recursive) : LeanTween.TextAlpha(item.gameObject.GetComponent <RectTransform>(), item.to.x, d, item.recursive);
                break;

            case TweenAction.CanvasGroupAlpha:
                tween = code ? AppendRect("CanvasGroup", item.to.x, d) : LeanTween.CanvasGroupAlpha(item.gameObject.GetComponent <RectTransform>(), item.to.x, d);
                break;

            case TweenAction.CanvasColor:
                tween = code ? AppendRect("Color", item.colorTo, d, item.recursive) : LeanTween.Color(item.gameObject.GetComponent <RectTransform>(), item.colorTo, d, item.recursive);
                break;

            case TweenAction.CanvasTextColor:
                tween = code ? AppendRect("TextColor", item.colorTo, d, item.recursive) : LeanTween.TextColor(item.gameObject.GetComponent <RectTransform>(), item.colorTo, d, item.recursive);
                break;

            case TweenAction.DelayedSound:
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.DelayedSound(gameObject, passAudioClipHere, " + vecToStr(item.from) + ", " + d + "f)");
                }
                else
                {
                    tween = LeanTween.delayedSound(gameObject, item.audioClip, item.from, item.duration);
                }
                break;

            default:
                tween = null;
                Debug.Log("The tween '" + item.action.ToString() + "' has not been implemented. info item:" + item);
                return;
            }

            if (item.onCompleteItem.GetPersistentEventCount() > 0)
            {
                LeanTween.DelayedCall(gameObject, GetItemTotalTime(item), item.CallOnCompleteItem);
            }
            if (item.onCompleteLoop.GetPersistentEventCount() > 0)
            {
                float timeToWait = item.duration + item.delay;
                for (int i = 0; i < item.loopCount; i++)
                {
                    LeanTween.DelayedCall(gameObject, timeToWait, item.CallOnCompleteLoop);

                    timeToWait += item.loopDelay + item.duration;
                }
            }

            // Append Extras
            if (generateCode)
            {
                if (delay > 0f)
                {
                    codeBuild.Append(".SetDelay(" + delay + "f)");
                }
            }
            else
            {
                tween = tween.SetDelay(delay);
            }
            if (item.ease == LeanTweenType.AnimationCurve)
            {
                if (generateCode)
                {
                    codeBuild.Append(".SetEase(");
                    Append(item.animationCurve);
                    codeBuild.Append(")");
                }
                else
                {
                    tween.SetEase(item.animationCurve);
                }
            }
            else
            {
                if (generateCode)
                {
                    if (item.ease != LeanTweenType.Linear)
                    {
                        codeBuild.Append(".SetEase(LeanTweenType." + item.ease + ")");
                    }
                }
                else
                {
                    tween.SetEase(item.ease);
                }
            }
            // Debug.Log("curve:"+item.animationCurve+" item.ease:"+item.ease);
            if (item.between == LeanTweenBetween.FromTo)
            {
                if (generateCode)
                {
                    codeBuild.Append(".SetFrom(" + vecToStr(item.from) + ")");
                }
                else
                {
                    tween.SetFrom(item.from);
                }
            }
            if (item.doesLoop)
            {
                if (generateCode)
                {
                    codeBuild.Append(".SetRepeat(" + item.loopCount + ")");
                    codeBuild.Append(".SetLoopDelay(" + item.loopDelay + "f)");
                }
                else
                {
                    tween.SetLoopDelay(item.loopDelay);
                    tween.SetRepeat(item.loopCount);
                }

                if (item.loopType == LoopType.PingPong)
                {
                    if (generateCode)
                    {
                        codeBuild.Append(".SetLoopPingPong()");
                    }
                    else
                    {
                        tween.SetLoopPingPong();
                    }
                }
                else if (item.loopType == LoopType.Add)
                {
                    if (generateCode)
                    {
                        codeBuild.Append(".SetLoopAdd()");
                    }
                    else
                    {
                        tween.SetLoopAdd();
                    }
                }
            }
            if (generateCode)
            {
                if (item.useSpeed)
                {
                    codeBuild.Append(".SetSpeed(" + item.speed + "f)");
                }
            }
            else
            {
                if (item.useSpeed)
                {
                    tween.SetSpeed(item.speed);
                }
            }
            if (generateCode)
            {
                codeBuild.Append(";\n");
            }
        }
 public static void SetEaseIndex(LeanTweenItem item, int newIndex)
 {
     item.ease    = (LeanTweenType)LTVisualShared.easeIntMapping[newIndex];
     item.easeStr = LTVisualShared.easeStrMapping[newIndex];
 }
 public static void SetActionIndex(LeanTweenItem item, int index)
 {
     item.action    = (TweenAction)methodIntMapping[index];
     item.actionStr = methodStrMapping[index];
 }
Example #8
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            LeanTweenVisual mainTarget = target as LeanTweenVisual;

            EditorGUI.BeginChangeCheck();
            float   overallDelay = 0;
            bool    clicked, deleted;
            Vector3 vec;

            clicked = false;

            bool playOnStartBefore = mainTarget.playOnStart;

            EditorGUILayout.BeginHorizontal();
            bool playOnStartNow = EditorGUILayout.Toggle(new GUIContent("Play on Start", "Tweens won't start automatically, you can start them via code with .start()"), mainTarget.playOnStart);


            EditorGUILayout.EndHorizontal();

            if (playOnStartBefore != playOnStartNow)
            {
                foreach (LeanTweenVisual tweenVisual in tweens)
                {
                    Undo.RecordObject(tweenVisual, "Toggling play on start");
                    tweenVisual.playOnStart = playOnStartNow;
                }
            }

            EditorGUILayout.BeginHorizontal();
            bool generateCode = EditorGUILayout.Toggle(new GUIContent("Generate Code", "If C# code will be generated"), mainTarget.generateCode);

            tweens.ForEach(tween => tween.generateCode = generateCode);

            GUIContent restartOnEnableGui      = new GUIContent("Restart on enable", "When you enable the gameobject these set of tweens will start again");
            bool       newRestartOnEnableValue = EditorGUILayout.Toggle(restartOnEnableGui, mainTarget.restartOnEnable);

            foreach (LeanTweenVisual leanTween in tweens)
            {
                Change(ref leanTween.restartOnEnable, newRestartOnEnableValue, leanTween, "Restart on Enable");
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Separator();

            #region Simulation Stuff

            if (mainTarget.isSimulating)
            {
                GUI.enabled = false;
            }

            EditorGUILayout.BeginHorizontal();
            bool simulateTemp = EditorGUILayout.Toggle(new GUIContent("Simulate", "Mark to see the tweens in the edit mode."), mainTarget.simulate);
            EditorGUILayout.EndHorizontal();
            GUI.enabled = true;

            // Reset Values
            EditorGUILayout.BeginHorizontal();
            if (!mainTarget.isSimulating)
            {
                GUI.enabled = false;
            }
            bool stopSimulation = EditorGUILayout.Toggle(new GUIContent("Stop simulation", "Click to stop the simulation"), mainTarget.stopSimulation);
            GUI.enabled = true;
            foreach (LeanTweenVisual visual in tweens)
            {
                if (visual.isSimulating)
                {
                    visual.stopSimulation = stopSimulation;
                }
            }

            if (mainTarget.isSimulating)
            {
                GUI.enabled = false;
            }
            bool resetValues = EditorGUILayout.Toggle(new GUIContent("Reset Values", "Click when the values of your GameObject don't reset after simulation."),
                                                      mainTarget.resetValues);
            GUI.enabled = true;
            EditorGUILayout.EndHorizontal();

            for (int i = 0; i < tweens.Length; i++)
            {
                if (!tweens[i].isSimulating)
                {
                    if (resetValues && tweens[i].hasSimulated)
                    {
                        ResetValues(tweens[i]);
                    }
                }
                else
                {
                    if (stopSimulation)
                    {
                        tweens[i].Cancel();
                        StopSimulation(tweens[i]);
                    }
                }
            }

            for (int i = 0; i < tweens.Length; i++)
            {
                if (!tweens[i].isSimulating)
                {
                    tweens[i].simulate = simulateTemp;
                    if (simulateTemp)
                    {
                        tweens[i].isSimulating = true;

                        GetStartValues(tweens[i]);
                        tweens[i].simulationTimer = tweens[i].GetAllGroupsTotalDuration() + Time.realtimeSinceStartup + tweens[i].timeToFinishSimulation;
                        if (qttOfAtualSimulations == 0)
                        {
                            EditorApplication.update += () => SimulationTimer(tweens);
                        }

                        if (tweens[i].loopAllCount < 0)
                        {
                            tweens[i].resetRepeatAfterSimulation = true;
                            tweens[i].loopAllCount = tweens[i].defaultLoopCount;
                        }
                        LeanTween.canUseInEditMode = true;
                        tweens[i].Simulate();

                        tweens[i].simulate = false;
                    }
                }
            }

            EditorGUILayout.BeginHorizontal();
            Change(ref mainTarget.timeToFinishSimulation,
                   EditorGUILayout.FloatField(new GUIContent("Time To Finish", "Time until restart this GameObject when simulate finishes."), mainTarget.timeToFinishSimulation),
                   mainTarget,
                   "Time to Finish");
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUIContent defaultLoopGui = new GUIContent("Default Loop Count",
                                                       "Default loop count in a simulation when loopCount is infinite. (In Play Mode will work normally)");

            Change(ref mainTarget.defaultLoopCount,
                   EditorGUILayout.IntField(defaultLoopGui, mainTarget.defaultLoopCount),
                   mainTarget,
                   "Default loop count");

            if (mainTarget.defaultLoopCount < 2)
            {
                mainTarget.defaultLoopCount = 2;
            }

            EditorGUILayout.EndHorizontal();

            #endregion

            EditorGUILayout.Separator();

            #region Repeat Stuff

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.LabelField(new GUIContent("All Delay", "Delay before start the whole set of tween groups."), GUILayout.Width(90));
            float newAllDelay = EditorGUILayout.FloatField("", mainTarget.allDelay);
            for (int i = 0; i < tweens.Length; i++)
            {
                Change(ref tweens[i].allDelay, newAllDelay, tweens[i], "All delay");
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            bool newDoesAllLoop = EditorGUILayout.Toggle(new GUIContent("Loop All", "Repeat the whole set of tween groups once they finish"), mainTarget.doesAllLoop);
            for (int i = 0; i < tweens.Length; i++)
            {
                Change(ref tweens[i].doesAllLoop, newDoesAllLoop, tweens[i], "Loop All");
            }
            EditorGUILayout.EndHorizontal();

            if (mainTarget.doesAllLoop)
            {
                float newLoopAllDelay = EditorGUILayout.FloatField(new GUIContent("    Loop All Delay", "Delay between each all loop."), mainTarget.loopAllDelay);
                for (int i = 0; i < tweens.Length; i++)
                {
                    Change(ref tweens[i].loopAllDelay, newLoopAllDelay, tweens[i], "Loop All Delay");
                }

                int newLoopAllCount = EditorGUILayout.IntField(new GUIContent("    Loop All Count", "Quantity of loops all tweens will make."), mainTarget.loopAllCount);
                for (int i = 0; i < tweens.Length; i++)
                {
                    Change(ref tweens[i].loopAllCount, newLoopAllCount, tweens[i], "Loop All Count");
                }

                if (mainTarget.loopAllCount == 0 || mainTarget.loopAllCount == 1)
                {
                    tweens.ForEach(x => x.loopAllCount = 2);
                }
            }
            #endregion


            float addedGroupDelay = 0f;
            int   groupIndex      = 0;
            foreach (LeanTweenGroup group in mainTarget.groupList)
            {
                EditorGUILayout.Space();

                EditorGUILayout.BeginHorizontal();
                GUI.color = LTEditor.Shared.colorGroupName;

                group.foldout = EditorGUILayout.Foldout(group.foldout, "", LTEditor.Shared.styleGroupFoldout);

                string groupStatus = "Group: " + group.groupName + " " + (group.StartTime) + "s - " + (mainTarget.GetGroupEndTime(group) + group.StartTime) + "s";
                if (group.doesLoop)
                {
                    if (group.loopCount < 1)
                    {
                        groupStatus += "    (* %%)";
                    }
                    else
                    {
                        groupStatus += "    (* " + group.loopCount + ")";
                    }
                }

                clicked   = GUILayout.Button(groupStatus, LTEditor.Shared.styleGroupButton);
                GUI.color = LTEditor.Shared.colorDelete;
                deleted   = GUILayout.Button("Delete", LTEditor.Shared.styleDeleteGroupButton);
                EditorGUILayout.EndHorizontal();
                GUI.color = Color.white;

                if (clicked)
                {
                    group.foldout = !group.foldout;
                }
                if (deleted)
                {
                    Undo.RecordObject(mainTarget, "Removing group item");
                    mainTarget.groupList.Remove(group);
                    break;
                }

                float addedTweenDelay = 0f;
                if (group.foldout)
                {
                    group.groupName = EditorGUILayout.TextField("Group Name", group.groupName);
                    EditorGUILayout.BeginHorizontal();
                    group.doesLoop = EditorGUILayout.Toggle("Group Loop", group.doesLoop);
                    group.delay    = EditorGUILayout.FloatField("Group Delay", group.delay);
                    EditorGUILayout.EndHorizontal();

                    if (group.doesLoop)
                    {
                        group.loopCount = EditorGUILayout.IntField("Group Loop Count", group.loopCount);
                        if (group.loopCount == 0 || group.loopCount == 1)
                        {
                            group.loopCount = 2;
                        }

                        group.loopDelay = EditorGUILayout.FloatField(new GUIContent("Group Loop Delay", "Delay between each group loop"), group.loopDelay);
                    }

                    group.gameObject = EditorGUILayout.ObjectField("Group GameObject", group.gameObject, typeof(GameObject), true) as GameObject;
                    if (group.gameObject == null)
                    { // Should default to the current object
                        group.gameObject = mainTarget.gameObject;
                    }

                    int i = 0;
                    foreach (LeanTweenItem item in group.itemList)
                    {
                        if (item.actionStr == null)
                        {
                            item.actionStr = "MOVE";
                        }
                        //if (item.actionStr != null)
                        // {

                        #region TweenStatus and DeleteButton
                        EditorGUILayout.Separator();
                        GUI.color = LTEditor.Shared.colorTweenName;
                        EditorGUILayout.BeginHorizontal();

                        string actionName = LTVisualShared.methodLabels[LTVisualShared.actionIndex(item)];
                        item.foldout = EditorGUILayout.Foldout(item.foldout, "", LTEditor.Shared.styleItemFoldout);

                        string itemStatus = actionName + ": " + (item.delay) + "s - " + (item.delay + item.duration) + "s";
                        if (item.doesLoop)
                        {
                            if (item.loopCount < 0)
                            {
                                itemStatus += "    (* %%)";
                            }
                            else
                            {
                                itemStatus += "    (* " + item.loopCount + ")";
                            }
                        }

                        bool tweenClicked = GUILayout.Button(itemStatus, LTEditor.Shared.styleItemButton);
                        if (tweenClicked)
                        {
                            item.foldout = !item.foldout;
                        }

                        GUI.color = LTEditor.Shared.colorDelete;
                        deleted   = GUILayout.Button("Delete", LTEditor.Shared.styleDeleteGroupButton);
                        EditorGUILayout.EndHorizontal();
                        GUI.color = Color.white;
                        #endregion

                        if (clicked)
                        {
                            item.foldout = !item.foldout;
                        }
                        if (deleted)
                        {
                            Undo.RecordObject(mainTarget, "Removing tween item");
                            group.itemList.Remove(item);

                            break;
                        }

                        if (item.foldout)
                        {
                            #region Action Field
                            EditorGUILayout.BeginHorizontal();

                            EditorGUILayout.LabelField("    Action", GUILayout.Width(70));
                            int  atualIndex     = LTVisualShared.actionIndex(item);
                            int  newActionIndex = EditorGUILayout.Popup("", atualIndex, LTVisualShared.methodLabels, GUILayout.Width(160));
                            bool changeAction   = false;
                            if (newActionIndex != atualIndex)
                            {
                                Undo.RecordObject(mainTarget, "Change action index");
                                LTVisualShared.SetActionIndex(item, newActionIndex);
                                changeAction     = true;
                                item.alignToPath = false;
                            }
                            TweenAction a = (TweenAction)Enum.Parse(typeof(TweenAction), item.actionStr, true);
                            item.action     = a;
                            item.actionLast = (int)item.action;

                            EditorGUILayout.EndHorizontal();
                            #endregion

                            item.gameObject = EditorGUILayout.ObjectField("    GameObject", item.gameObject, typeof(GameObject), true /*, GUILayout.Width(250)*/) as GameObject;
                            if (item.gameObject == null)
                            { // Should default to the current object
                                item.gameObject = mainTarget.gameObject;
                            }

                            // Path
                            bool isBezier = a == TweenAction.MoveBezier || a == TweenAction.MoveBezierLocal || a == TweenAction.CanvasMoveBezier ||
                                            a == TweenAction.CanvasMoveBezierLocal;
                            bool isSpline = a == TweenAction.MoveSplineLocal || a == TweenAction.MoveSpline;
                            bool isCurve  = false;
                            if (isBezier || isSpline)
                            {
                                isCurve = true;

                                if (isBezier)
                                {
                                    item.bezierPath = EditorGUILayout.ObjectField("    LeanTweenPath:", item.bezierPath, typeof(LeanTweenPath), true) as LeanTweenPath;
                                }
                                else
                                {
                                    item.splinePath = EditorGUILayout.ObjectField("    LeanTweenPath:", item.splinePath, typeof(LeanTweenPath), true) as LeanTweenPath;
                                }

                                EditorGUILayout.BeginHorizontal();
                                EditorGUILayout.LabelField("   Orient to Path", GUILayout.Width(95));
                                Change(ref item.orientToPath, EditorGUILayout.Toggle(item.orientToPath), mainTarget, "Orient to Path");

                                EditorGUILayout.LabelField(new GUIContent("    Align to Path", "Click to align the object with the start of the path."),
                                                           GUILayout.Width(90));
                                bool align   = EditorGUILayout.Toggle(item.alignToPath);
                                bool changed = align != wasAligned ? true : false;
                                wasAligned = align;

                                Undo.RecordObject(mainTarget, "Aligned to path");
                                item.alignToPath = align;

                                if (a != TweenAction.MoveBezierLocal && a != TweenAction.MoveSplineLocal && a != TweenAction.CanvasMoveBezierLocal)
                                {
                                    if (item.alignToPath)
                                    {
                                        if (isBezier)
                                        {
                                            LTBezierPath lTBezier = new LTBezierPath(item.bezierPath.vec3);

                                            Vector3 pt0 = lTBezier.Point(0.002f);
                                            mainTarget.transform.position = pt0;

                                            Vector3 added = lTBezier.Point(0.003f);
                                            Vector3 v3Dir = added - mainTarget.transform.position;
                                            float   angle = Mathf.Atan2(v3Dir.y, v3Dir.x) * Mathf.Rad2Deg;
                                            mainTarget.transform.eulerAngles = new Vector3(0, 0, angle);
                                        }
                                        else
                                        {
                                            mainTarget.transform.position = item.splinePath.splineVector()[0];
                                        }
                                    }
                                    else
                                    {
                                        if (changed && !changeAction)
                                        {
                                            mainTarget.transform.position    = notAlignedPosition;
                                            mainTarget.transform.eulerAngles = notAlignedRotation;
                                        }
                                        else
                                        {
                                            notAlignedPosition = mainTarget.transform.position;
                                            notAlignedRotation = mainTarget.transform.eulerAngles;
                                        }
                                    }
                                }

                                if (isBezier)
                                {
                                    EditorGUILayout.LabelField("    2D Path", GUILayout.Width(65));
                                    Change(ref item.isPath2d, EditorGUILayout.Toggle(item.isPath2d), mainTarget, "2D Path");
                                }

                                EditorGUILayout.EndHorizontal();
                            }

                            if (isCurve == false)
                            {
                                bool isVector = a == TweenAction.Move || a == TweenAction.MoveLocal || a == TweenAction.MoveAdd || a == TweenAction.CanvasMove ||
                                                a == TweenAction.CanvasMoveAdd || a == TweenAction.Scale || a == TweenAction.ScaleAdd || a == TweenAction.CanvasScale ||
                                                a == TweenAction.CanvasScaleAdd || a == TweenAction.CanvasSize || a == TweenAction.DelayedSound || a == TweenAction.CanvasRotate ||
                                                a == TweenAction.CanvasSizeAdd || a == TweenAction.RotateAdd || a == TweenAction.CanvasRotateAdd || a == TweenAction.CanvasRotateLocal ||
                                                a == TweenAction.Rotate || a == TweenAction.RotateLocal;

                                bool isColor = a == TweenAction.Color || a == TweenAction.CanvasColor || a == TweenAction.CanvasTextColor || a == TweenAction.ColorGroup;

                                bool isAlpha = a == TweenAction.Alpha || a == TweenAction.AlphaVertex || a == TweenAction.CanvasAlpha || a == TweenAction.CanvasTextAlpha ||
                                               a == TweenAction.CanvasGroupAlpha || a == TweenAction.AlphaGroup;

                                bool isPlay   = a == TweenAction.CanvasPlaySprite;
                                bool usesFrom = !isColor && !isPlay;

                                // From Values
                                EditorGUILayout.BeginHorizontal();
                                if (usesFrom)
                                { // Not a Color tween
                                    EditorGUILayout.LabelField(new GUIContent("    From", "Specify where the tween starts from, otherwise it will start from it's current value"), GUILayout.Width(50));
                                    LeanTweenBetween between = EditorGUILayout.Toggle("", item.between == LeanTweenBetween.FromTo, GUILayout.Width(30)) ? LeanTweenBetween.FromTo : LeanTweenBetween.To;
                                    if (between != item.between)
                                    {
                                        Undo.RecordObject(mainTarget, "Changing to from/to");
                                        item.between = between;
                                    }
                                }
                                if (item.between == LeanTweenBetween.FromTo)
                                {
                                    if (isVector)
                                    {
                                        //										item.from = EditorGUILayout.Vector3Field("", item.from);
                                        Change(ref item.from, EditorGUILayout.Vector3Field("", item.from), mainTarget, "Changing from");
                                    }
                                    else if (isColor)
                                    {
                                    }
                                    else
                                    {
                                        vec   = Vector3.zero;
                                        vec.x = EditorGUILayout.FloatField("From", item.from.x);

                                        if (vec.x != item.from.x)
                                        {
                                            Undo.RecordObject(mainTarget, "Setting new from value");
                                            item.from = vec;
                                        }
                                    }
                                }
                                EditorGUILayout.EndHorizontal();

                                // To Values
                                EditorGUILayout.BeginHorizontal();
                                if (isVector)
                                {
                                    EditorGUILayout.LabelField("    To", GUILayout.Width(85));
                                    Change(ref item.to, EditorGUILayout.Vector3Field("", item.to), mainTarget, "Changing vector3 to");
                                }
                                else if (isColor)
                                {
                                    EditorGUILayout.LabelField("    To", GUILayout.Width(85));
                                    Change(ref item.colorTo, EditorGUILayout.ColorField("", item.colorTo), mainTarget, "Change color to");
                                }
                                else if (isPlay)
                                {
                                    item.doesLoop = true;

                                    GUILayout.Space(24);
                                    item.spritesMaximized = EditorGUILayout.Foldout(item.spritesMaximized, "Sprites");
                                    if (item.spritesMaximized)
                                    {
                                        EditorGUILayout.LabelField("Add", GUILayout.Width(35));
                                        UnityEngine.Sprite sprite = EditorGUILayout.ObjectField("", null, typeof(UnityEngine.Sprite), true, GUILayout.Width(150)) as UnityEngine.Sprite;
                                        if (sprite != null)
                                        {
                                            Undo.RecordObject(mainTarget, "Adding a sprite");
                                            item.sprites = Add(item.sprites, sprite);
                                        }
                                        EditorGUILayout.Separator();
                                        EditorGUILayout.Separator();
                                        EditorGUILayout.Separator();
                                    }
                                }
                                else
                                {
                                    vec = Vector3.zero;
                                    EditorGUILayout.LabelField("    To", GUILayout.Width(85));

                                    float setToX;
                                    if (isAlpha)
                                    {
                                        setToX = EditorGUILayout.Slider("", item.to.x, 0, 1f);
                                    }
                                    else
                                    {
                                        setToX = EditorGUILayout.FloatField("", item.to.x);
                                    }


                                    Undo.RecordObject(mainTarget, "Setting x to");
                                    vec.x   = setToX;
                                    item.to = vec;
                                }
                                EditorGUILayout.EndHorizontal();

                                // Sprite List
                                if (isPlay && item.spritesMaximized)
                                {
                                    for (int j = 0; j < item.sprites.Length; j++)
                                    {
                                        EditorGUILayout.BeginHorizontal();
                                        EditorGUILayout.LabelField("        sprite" + j, GUILayout.Width(85));
                                        item.sprites[j] = EditorGUILayout.ObjectField("", item.sprites[j], typeof(UnityEngine.Sprite), true) as UnityEngine.Sprite;
                                        GUI.color       = LTEditor.Shared.colorDelete;
                                        deleted         = GUILayout.Button("Delete", LTEditor.Shared.styleDeleteButton);
                                        GUI.color       = Color.white;
                                        EditorGUILayout.EndHorizontal();

                                        if (deleted)
                                        {
                                            Undo.RecordObject(mainTarget, "Removing sprite");
                                            item.sprites = Remove(item.sprites, j);
                                            break;
                                        }
                                    }
                                }
                            }
                            EditorGUILayout.Space();

                            // Easing
                            if (a == TweenAction.DelayedSound)
                            {
                                Change(ref item.audioClip, EditorGUILayout.ObjectField("    AudioClip:", item.audioClip, typeof(AudioClip), true) as AudioClip, mainTarget, "set audio clip");
                            }
                            else
                            {
                                EditorGUILayout.BeginHorizontal();
                                EditorGUILayout.LabelField("    Easing", GUILayout.Width(70));

                                int easeIndex    = LTVisualShared.EaseIndex(item);
                                int easeIndexNew = EditorGUILayout.Popup("", easeIndex, LTVisualShared.easeStrMapping, GUILayout.Width(128));
                                if (easeIndex != easeIndexNew)
                                {
                                    Undo.RecordObject(mainTarget, "changing easing type");
                                    LTVisualShared.SetEaseIndex(item, easeIndexNew);
                                }

                                EditorGUILayout.Separator();
                                EditorGUILayout.EndHorizontal();

                                if (item.ease == LeanTweenType.AnimationCurve)
                                {
                                    Undo.RecordObject(mainTarget, "changing easing type anim curve");
                                    item.animationCurve = EditorGUILayout.CurveField("    Ease Curve", item.animationCurve);
                                }
                                EditorGUILayout.Space();
                            }
                            if (item.ease >= LeanTweenType.Once && item.ease < LeanTweenType.AnimationCurve)
                            {
                                EditorGUILayout.LabelField(new GUIContent("   ERROR: You Specified a non-easing type", "Select a type with the value 'Ease' in front of it (or linear)"), EditorStyles.boldLabel);
                            }

                            // Speed

                            EditorGUILayout.BeginHorizontal();
                            Change(ref item.useSpeed, EditorGUILayout.Toggle("    Use Speed", item.useSpeed), mainTarget, "toggled use speed");
                            EditorGUILayout.EndHorizontal();

                            // Timing
                            if (i > 0)
                            {
                                Change(ref item.alignWithPrevious, EditorGUILayout.Toggle(new GUIContent("    Align with Previous", "When you change the timing of a previous tween, this tween's timing will be adjusted to follow afterwards."), item.alignWithPrevious),
                                       mainTarget, "toggle align with previous");
                            }
                            EditorGUILayout.BeginHorizontal();
                            if (i > 0 && item.alignWithPrevious)
                            {
                                Change(ref item.delay, addedTweenDelay, mainTarget, "change delay");
                                EditorGUILayout.LabelField("    Delay:   " + item.delay, GUILayout.Width(50));
                            }
                            else
                            {
                                EditorGUILayout.LabelField("    Delay", GUILayout.Width(50));
                                Change(ref item.delay, EditorGUILayout.FloatField("", item.delay, GUILayout.Width(50)), mainTarget, "change delay");
                            }

                            if (a == TweenAction.DelayedSound)
                            {
                                EditorGUILayout.LabelField("Volume", GUILayout.Width(50));
                                Change(ref item.duration, EditorGUILayout.FloatField("", item.duration, GUILayout.Width(50)), mainTarget, "change volume");
                            }
                            else if (a == TweenAction.CanvasPlaySprite)
                            {
                                EditorGUILayout.LabelField("Frame Rate", GUILayout.Width(85));
                                Change(ref item.frameRate, EditorGUILayout.FloatField("", item.frameRate, GUILayout.Width(50)), mainTarget, "change volume");
                            }
                            else if (item.useSpeed)
                            {
                                EditorGUILayout.LabelField("Speed", GUILayout.Width(50));
                                Change(ref item.speed, EditorGUILayout.FloatField("", item.speed, GUILayout.Width(50)), mainTarget, "change speed");
                            }
                            else
                            {
                                EditorGUILayout.LabelField("Time", GUILayout.Width(50));
                                float newDuration = EditorGUILayout.FloatField("", item.duration, GUILayout.Width(50));
                                if (newDuration <= 0.0f)
                                {
                                    newDuration = 0.0001f;
                                }
                                Change(ref item.duration, newDuration, mainTarget, "change timing");
                            }
                            EditorGUILayout.Separator();
                            EditorGUILayout.EndHorizontal();


                            // Repeat
                            EditorGUILayout.Space();
                            EditorGUILayout.BeginHorizontal();
                            EditorGUILayout.LabelField("    Loops", GUILayout.Width(50));
                            Change(ref item.doesLoop, EditorGUILayout.Toggle("", item.doesLoop, GUILayout.Width(50)), mainTarget, "Toggled does loop");

                            if (item.doesLoop)
                            {
                                EditorGUILayout.LabelField(new GUIContent("Repeat", "-1 repeats infinitely"), GUILayout.Width(50));
                                Change(ref item.loopCount, EditorGUILayout.IntField(new GUIContent("", ""), item.loopCount, GUILayout.Width(50)), mainTarget, "changed loop count");
                                if (item.loopCount == 0 || item.loopCount == 1)
                                {
                                    item.loopCount = 2;
                                }
                                EditorGUILayout.LabelField(new GUIContent("    Wrap", "How the tween repeats\nClamp: restart from beginning\nPingpong: goes back and forth\nAdd: not reset when finished."), GUILayout.Width(50));
                                int index = (int)item.loopType - 1; // -1 cause Once is not in list Normal list -> {Once, Clamp, PingPong, Add};
                                index = EditorGUILayout.Popup("", index, new string[] { "Clamp", "Ping Pong", "Add" }, GUILayout.Width(70));
                                EditorGUILayout.EndHorizontal();

                                LoopType newLoopType = LoopType.Clamp;
                                switch (index)
                                {
                                case 0:
                                    newLoopType = LoopType.Clamp;
                                    break;

                                case 1:
                                    newLoopType = LoopType.PingPong;
                                    break;

                                case 2:
                                    newLoopType = LoopType.Add;
                                    break;
                                }

                                if (newLoopType != item.loopType)
                                {
                                    Undo.RecordObject(mainTarget, "change loop type");
                                    item.loopType = newLoopType;
                                }

                                EditorGUILayout.BeginHorizontal();
                                EditorGUILayout.LabelField(new GUIContent("    LoopDelay", "Delay between each loop of this tween."), GUILayout.Width(90));
                                Change(ref item.loopDelay, EditorGUILayout.FloatField("", item.loopDelay, GUILayout.Width(50)), mainTarget, "Changed loop delay");
                                if (item.loopDelay < 0)
                                {
                                    item.loopDelay = 0;
                                }
                                EditorGUILayout.EndHorizontal();
                            }
                            else
                            {
                                EditorGUILayout.EndHorizontal();
                            }

                            EditorGUILayout.Separator();

                            EditorGUILayout.BeginHorizontal();
                            //EditorGUILayout.LabelField("", GUILayout.Width(100));

                            item.callbackFoldout = EditorGUILayout.Foldout(item.callbackFoldout, "", LTEditor.Shared.styleCallbackFoldout);

                            GUI.color = Color.gray;
                            bool callbacksClicked = GUILayout.Button("Callbacks", LTEditor.Shared.styleCallbackButton);
                            GUI.color = Color.white;

                            EditorGUILayout.EndHorizontal();

                            if (callbacksClicked)
                            {
                                item.callbackFoldout = !item.callbackFoldout;
                            }

                            if (item.callbackFoldout)
                            {
                                #region Draw UnityEvents
                                SerializedProperty prop = serializedObject.GetIterator();
                                while (prop.NextVisible(true))
                                {
                                    string itemPath     = $"groupList.Array.data[{groupIndex}].itemList.Array.data[{i}]";
                                    bool   drawProperty = (prop.propertyPath == itemPath + ".onCompleteLoop") ||
                                                          (prop.propertyPath == itemPath + ".onCompleteItem");

                                    if (drawProperty)
                                    {
                                        EditorGUILayout.Separator();

                                        EditorGUILayout.BeginHorizontal();
                                        EditorGUILayout.LabelField("", GUILayout.Width(28));
                                        EditorGUILayout.PropertyField(prop);
                                        EditorGUILayout.EndHorizontal();
                                    }
                                }
                                #endregion
                            }

                            addedTweenDelay = item.duration + item.delay + (item.loopDelay * item.loopCount);

                            EditorGUILayout.Separator();
                            EditorGUILayout.Separator();

                            i++;
                        }
                    }
                    EditorGUILayout.Separator();
                    if (ShowLeftButton("+ Tween", LTEditor.Shared.colorAddTween, 15))
                    {
                        Undo.RecordObject(mainTarget, "adding another tween");
                        LeanTweenItem newItem = new LeanTweenItem(addedTweenDelay);
                        //newItem.alignWithPrevious = true;
                        group.itemList.Add(newItem);
                    }
                    addedGroupDelay += addedTweenDelay;

                    EditorGUILayout.Separator();
                }
                overallDelay += mainTarget.GetGroupEndTime(group);
                groupIndex++;
            }

            EditorGUILayout.Separator();
            if (ShowLeftButton("+ Group", LTEditor.Shared.colorAddGroup))
            {
                Undo.RecordObject(mainTarget, "adding another group");
                // Debug.Log("adding group with delay:"+addedGroupDelay);
                mainTarget.groupList.Add(new LeanTweenGroup(addedGroupDelay));
            }

            if (mainTarget.generateCode && !mainTarget.isSimulating)
            {
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();
                EditorGUILayout.LabelField("Generated C# Code", EditorStyles.boldLabel);
                EditorGUILayout.BeginHorizontal();
                if (Application.isPlaying == false)
                {
                    scrollCodeViewPos = EditorGUILayout.BeginScrollView(scrollCodeViewPos, GUILayout.Height(150));

                    EditorGUILayout.TextArea(mainTarget.BuildAllTweens(true, true), LTEditor.Shared.styleCodeTextArea);

                    EditorGUILayout.EndScrollView();
                }
                else
                {
                    EditorGUILayout.LabelField("    Not available during runtime");
                }
                EditorGUILayout.EndHorizontal();
            }

            EditorGUI.EndChangeCheck();
            serializedObject.ApplyModifiedProperties();
        }