public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(mAsset);

            if (mAsset.objectReferenceValue == null)
            {
                EditorGUILayout.HelpBox(
                    "This Dynamic Object has not been exported to an asset yet. Please click Export Dynamic Object " +
                    "to do so.", MessageType.Warning);
            }

            EditorGUILayout.Space();

            if (GUILayout.Button("Export Dynamic Object"))
            {
                if (mAsset.objectReferenceValue == null)
                {
                    var name = (target as SteamAudioDynamicObject).gameObject.scene.name + "_" + target.name;
                    mAsset.objectReferenceValue = SerializedData.PromptForNewAsset(name);
                    serializedObject.ApplyModifiedProperties();
                }

                SteamAudioManager.ExportDynamicObject(target as SteamAudioDynamicObject, false);
            }

            if (GUILayout.Button("Export Dynamic Object as OBJ"))
            {
                SteamAudioManager.ExportDynamicObject(target as SteamAudioDynamicObject, true);
            }

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(mAsset);

            var scene = (target as SteamAudioStaticMesh).gameObject.scene;

            if (mAsset.objectReferenceValue == null)
            {
                EditorGUILayout.HelpBox(
                    "This scene has not been exported. Click Steam Audio > Export Active Scene to export.",
                    MessageType.Warning);
            }
            else if (mSceneNameWhenExported.stringValue != scene.name)
            {
                EditorGUILayout.HelpBox(
                    string.Format("This geometry was last exported for the scene {0}. If this is not what you " +
                                  "intended, click Export As New Asset below.", mSceneNameWhenExported.stringValue),
                    MessageType.Warning);

                if (GUILayout.Button("Export As New Asset"))
                {
                    mAsset.objectReferenceValue        = SerializedData.PromptForNewAsset(scene.name);
                    mSceneNameWhenExported.stringValue = scene.name;
                    serializedObject.ApplyModifiedProperties();

                    SteamAudioManager.ExportScene(scene, false);
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
コード例 #3
0
        public SerializedData GetAsset()
        {
            if (asset == null)
            {
                asset = SerializedData.PromptForNewAsset(gameObject.scene.name + "_" + name);
            }

            return(asset);
        }