在此项目中,您能够访问使用 Visual Effect Graph 制作的示例场景和效果。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

39 行
1.3 KiB

#if VFX_OUTPUTEVENT_AUDIO
using UnityEngine;
using UnityEngine.VFX.Utility;
namespace UnityEditor.VFX.Utility
{
[CustomEditor(typeof(VFXOutputEventPlayAudio))]
class VFXOutputEventPlayAudioEditor : VFXOutputEventHandlerEditor
{
SerializedProperty m_AudioSource;
protected override void OnEnable()
{
base.OnEnable();
m_AudioSource = serializedObject.FindProperty(nameof(VFXOutputEventPlayAudio.audioSource));
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUI.BeginChangeCheck();
DrawOutputEventProperties();
EditorGUILayout.PropertyField(m_AudioSource);
HelpBox("Attribute Usage", "VFX Attributes are not used for this Output Event Handler");
if (EditorGUI.EndChangeCheck())
{
var newAudioSource = m_AudioSource.objectReferenceValue;
if ( newAudioSource != null
&& PrefabUtility.GetPrefabAssetType(newAudioSource) != PrefabAssetType.NotAPrefab
&& PrefabUtility.GetPrefabInstanceStatus(newAudioSource) != PrefabInstanceStatus.Connected)
m_AudioSource.objectReferenceValue = null;
serializedObject.ApplyModifiedProperties();
}
}
}
}
#endif