Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Created June 13, 2017 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/3c1de0800e528ea4b45096d1a46ca9d8 to your computer and use it in GitHub Desktop.
Save tsubaki/3c1de0800e528ea4b45096d1a46ca9d8 to your computer and use it in GitHub Desktop.
別シーンにあるAudioSourceを呼び出す
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu]
public class AudioManager : ScriptableObject
{
public void PlayOneShot(AudioClip clip)
{
if (audioSource != null) {
audioSource.PlayOneShot (clip);
}
}
public AudioSource audioSource{get; set;}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class MonoBehaviourEventTrigger : MonoBehaviour
{
public UnityEvent onAwake = new UnityEvent ();
public UnityEvent onDestroy = new UnityEvent ();
void Awake()
{
onAwake.Invoke ();
}
void OnDestroy()
{
onDestroy.Invoke ();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment