- Home /
 
 
               Question by 
               Broseph1010 · Jul 16, 2018 at 04:08 PM · 
                animationinverse kinematicexecuteineditmode  
              
 
              Problems with [ExecuteInEditMode]
I have this script which takes Empty GameObjects and translates their position to Unity's built-in IK system for the 4 limbs of my character. I want it to run in edit mode, because I want to animate the Empty GameObjects with Unity's animation, and I also want to see the translation to the limbs. I do not see where I messed up, I used [ExecuteInEditMode], and it is not. It also isn't outputting the message in Start.
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 [ExecuteInEditMode]
 public class IkProceduralAnimation : MonoBehaviour
 {
     Animator anim;
     public Transform LeftArmIkTarget;
     public Transform RightArmIkTarget;
     public Transform LeftLegIkTarget;
     public Transform RightLegIkTarget;
 
     public Transform Head;
     public Transform UpperTorso;
     public Transform LowerTorso;
 
     float ikWeight = 1;
     // Use this for initialization
     void Start()
     {
         anim = GetComponent<Animator>();
         Debug.Log("Starting In Edit Mode");
     }
 
     // Update is called once per frame
     void Update()
     {
       
     }
 
     void OnAnimatorIK()
     {
         anim.SetIKPositionWeight(AvatarIKGoal.LeftFoot, ikWeight);
         anim.SetIKPosition(AvatarIKGoal.LeftFoot, LeftLegIkTarget.position);
 
         anim.SetIKPositionWeight(AvatarIKGoal.RightFoot, ikWeight);
         anim.SetIKPosition(AvatarIKGoal.RightFoot, RightLegIkTarget.position);
 
         anim.SetIKPositionWeight(AvatarIKGoal.LeftHand, ikWeight);
         anim.SetIKPosition(AvatarIKGoal.LeftHand, LeftArmIkTarget.position);
 
         anim.SetIKPositionWeight(AvatarIKGoal.RightHand, ikWeight);
         anim.SetIKPosition(AvatarIKGoal.RightHand, RightArmIkTarget.position);
     }
 
 
 }
 
               Any help will be greatly appreciated!
               Comment
              
 
               
              Answer by WenBinLiu · Apr 09, 2020 at 07:34 PM
hi,actually OnAnimatorIk is not working in edit mode,you should ticking by yourself. Just Like this: // Update is called once per frame void Update() { anim.Update(0); }
Your answer