コード例 #1
0
        public override void OnInspectorGUI()
        {
            serializedObject.UpdateIfRequiredOrScript();

            EditorGUILayout.PropertyField(localSpace);

            if (GUILayout.Button("Clear"))
            {
                if (EditorUtility.DisplayDialog("Clear particle cache", "Are you sure you want to clear this cache?", "Ok", "Cancel"))
                {
                    Undo.RecordObject(cache, "Clear particle cache");
                    cache.Clear();
                }
            }

            // Print topology info:
            EditorGUILayout.HelpBox("Duration:" + cache.Duration + "\n" +
                                    "Frames:" + cache.FrameCount + "\n" +
                                    "Size in memory (kb):" + cache.SizeInBytes() * 0.001f, MessageType.Info);

            if (GUI.changed)
            {
                serializedObject.ApplyModifiedProperties();
            }
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            serializedObject.UpdateIfDirtyOrScript();

            EditorGUILayout.PropertyField(localSpace);

            if (GUILayout.Button("Clear"))
            {
                cache.Clear();
                EditorUtility.SetDirty(target);
            }

            // Print topology info:
            EditorGUILayout.HelpBox("Duration:" + cache.Duration + "\n" +
                                    "Frames:" + cache.FrameCount + "\n" +
                                    "Size in memory (kb):" + cache.SizeInBytes() * 0.001f, MessageType.Info);

            if (GUI.changed)
            {
                serializedObject.ApplyModifiedProperties();
            }
        }