UnityEditor.EditorCurveBinding.PPtrCurve C# (CSharp) Method

PPtrCurve() public static method

public static PPtrCurve ( string inPath, Type inType, string inPropertyName ) : EditorCurveBinding
inPath string
inType System.Type
inPropertyName string
return EditorCurveBinding
        public static EditorCurveBinding PPtrCurve(string inPath, Type inType, string inPropertyName)
        {
            return new EditorCurveBinding { 
                path = inPath,
                type = inType,
                propertyName = inPropertyName,
                m_isPPtrCurve = 1,
                m_isPhantom = 0
            };
        }
    }

Usage Example

示例#1
0
        private static bool CreateAnimation(GameObject gameObject, UnityEngine.Object[] frames)
        {
            Array.Sort <UnityEngine.Object>(frames, (UnityEngine.Object a, UnityEngine.Object b) => EditorUtility.NaturalCompare(a.name, b.name));
            string message       = string.Format("Create a new animation for the game object '{0}':", gameObject.name);
            string directoryName = Path.GetDirectoryName(AssetDatabase.GetAssetPath(frames[0]));
            string text          = EditorUtility.SaveFilePanelInProject("Create New Animation", "New Animation", "anim", message, directoryName);

            if (string.IsNullOrEmpty(text))
            {
                return(false);
            }
            AnimationClip animationClip = AnimationSelection.AllocateAndSetupClip(true);

            AssetDatabase.CreateAsset(animationClip, text);
            AnimationSelection.AddClipToAnimatorComponent(gameObject, animationClip);
            animationClip.frameRate = 12f;
            ObjectReferenceKeyframe[] array = new ObjectReferenceKeyframe[frames.Length];
            for (int i = 0; i < array.Length; i++)
            {
                array[i]       = default(ObjectReferenceKeyframe);
                array[i].value = SpriteUtility.RemapObjectToSprite(frames[i]);
                array[i].time  = (float)i / animationClip.frameRate;
            }
            EditorCurveBinding binding = EditorCurveBinding.PPtrCurve(string.Empty, typeof(SpriteRenderer), "m_Sprite");

            AnimationUtility.SetObjectReferenceCurve(animationClip, binding, array);
            return(true);
        }
All Usage Examples Of UnityEditor.EditorCurveBinding::PPtrCurve