Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created August 10, 2020 09:35
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 todorok1/f294a066b7e1b06fc045cc9c43360036 to your computer and use it in GitHub Desktop.
Save todorok1/f294a066b7e1b06fc045cc9c43360036 to your computer and use it in GitHub Desktop.
nullチェックをするコードのサンプル
/// <Summary>
/// AudioSourceへの参照がセットされているか確認する処理です。
/// </Summary>
void CheckAudioReference()
{
if (bgmAudio == null)
{
bgmAudio = gameObject.GetComponent<AudioSource>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment