private void DrawFrame()
 {
     if (Sequence.boolValue)
     {
         EditorGUILayout.PropertyField(Frames, true);
     }
     else
     {
         EditorGUI.BeginChangeCheck();
         {
             EditorGUILayout.PropertyField(Frames.GetArrayElementAtIndex(0), new GUIContent("Frame"));
         }
         if (EditorGUI.EndChangeCheck())
         {
             if (Sequence.boolValue != true)
             {
                 var propertyPath = AssetDatabase.GetAssetPath(Frames.GetArrayElementAtIndex(0).objectReferenceInstanceIDValue);
                 if (StickerEditorUtility.IsAnimatedTexture(propertyPath))
                 {
                     Sequence.boolValue = true;
                 }
             }
         }
     }
 }
        private void DrawDiskSizeHelpBox(Rect fieldRect, SerializedProperty stickerAsset)
        {
            var id         = GUIUtility.GetControlID(SizeOnDisk, FocusType.Passive);
            var helpRect2  = EditorGUI.PrefixLabel(fieldRect, id, SizeOnDisk);
            var sizeOnDisk = GetFileSize(stickerAsset.objectReferenceValue as Sticker);

            if (sizeOnDisk <= 500000L)
            {
                EditorGUI.HelpBox(helpRect2, StickerEditorUtility.GetFileSizeString(sizeOnDisk), MessageType.None);
            }
            else
            {
                EditorGUI.HelpBox(helpRect2, StickerEditorUtility.GetFileSizeString(sizeOnDisk) + " is too large", MessageType.Warning);
            }
        }
        private static bool DrawTexture(SerializedProperty sequence, Rect firstFrameRect, SerializedProperty frames, SerializedProperty fps, Texture2D firstFrameTexture, SerializedProperty firstFrame, SerializedProperty stickerName, SerializedObject sticker, ref bool updateIndexes)
        {
            if (sequence.boolValue && frames.arraySize > 1)
            {
                GUI.Box(firstFrameRect, GUIContent.none);
                var frameIndex = StickerEditor.AnimatedIndex(frames, fps);

                var texture = firstFrameTexture;
                if (texture == null)
                {
                    return(true);
                }
                if (frameIndex < frames.arraySize)
                {
                    texture = frames.GetArrayElementAtIndex(frameIndex).objectReferenceValue as Texture2D ?? firstFrameTexture;
                }
                EditorGUI.DrawTextureTransparent(firstFrameRect, texture);
            }
            else
            {
                EditorGUI.BeginChangeCheck();
                var texture = EditorGUI.ObjectField(firstFrameRect, firstFrame.objectReferenceValue as Texture2D, typeof(Texture2D), false);
                if (EditorGUI.EndChangeCheck())
                {
                    firstFrame.objectReferenceValue = texture;
                    if (texture != null)
                    {
                        stickerName.stringValue   = texture.name;
                        sticker.targetObject.name = texture.name;
                        updateIndexes             = true;

                        if (sequence.boolValue != true)
                        {
                            var propertyPath = AssetDatabase.GetAssetPath(firstFrame.objectReferenceInstanceIDValue);
                            if (StickerEditorUtility.IsAnimatedTexture(propertyPath))
                            {
                                sequence.boolValue = true;
                            }
                        }
                    }
                }
            }
            return(false);
        }