コード例 #1
0
        public override void OnInspectorGUI()
        {
            AudioSources audioSources = (AudioSources)target;            //get the target

            EditorGUILayout.Separator();
            audioSources.bubbleSFX = EditorGUILayout.ObjectField("Bubble SFX", audioSources.bubbleSFX, typeof(AudioClip)) as AudioClip;
            EditorGUILayout.HelpBox("Use the first AudioSource component below for the Music.", MessageType.Info);
            EditorGUILayout.HelpBox("Use the second AudioSource component below for the Sound Effects.", MessageType.Info);
            EditorGUILayout.HelpBox("* Click on Apply button that located on the top to save your changes", MessageType.Info);
            EditorGUILayout.Separator();
        }
コード例 #2
0
 // Use this for initialization
 void Awake()
 {
     if (instance == null)
     {
         instance     = this;
         audioSources = GetComponents <AudioSource>();
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }