This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class SingletonMonoBehaviourAutoCreate<T> : MonoBehaviour where T : MonoBehaviour | |
{ | |
private static T instance; | |
public static T Instance { | |
get { | |
if (instance == null) { | |
instance = (T)FindObjectOfType (typeof(T)); | |
if (instance == null) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class SingletonMonoBehaviourFromResources<T> : MonoBehaviour where T : MonoBehaviour | |
{ | |
private static T instance; | |
public static T Instance { | |
get { | |
if (instance == null) { | |
instance = (T)FindObjectOfType (typeof(T)); | |
if (instance == null) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yasuaki@YASUAKI-PC ~ | |
$ pwd | |
/c/Users/yasuaki | |
yasuaki@YASUAKI-PC ~ | |
$ cd Launch/Unity/Git | |
yasuaki@YASUAKI-PC ~/Launch/Unity/Git | |
$ git clone https://github.com/suakig/Unity-ShowCountCycle.git | |
Cloning into 'Unity-ShowCountCycle'... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public abstract class MonoSingleton<T> : MonoBehaviour where T : MonoSingleton<T> | |
{ | |
static T m_Instance = null; | |
public static T instance | |
{ | |
get | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine; | |
public abstract class MonoSingletonFromResources<T> : MonoBehaviour where T : MonoSingletonFromResources<T> | |
{ | |
private static readonly string RESOURCES_PATH = "Prefabs/Singletons/"; | |
static T m_Instance = null; | |
public static T instance | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class TestSingletonFromResources : MonoSingletonFromResources<TestSingletonFromResources> | |
{ | |
public int data1; | |
public int data2; | |
public int data3; | |
public int data4; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System; | |
using System.Collections; | |
public class TestSingletonFromResourcesTestCall : MonoBehaviour | |
{ | |
void Start () | |
{ | |
TestSingletonFromResources.instance.TestCall (); | |
Invoke ((Action)SceneMove, 1.0f); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System; | |
using System.Collections; | |
public class ArgumentChangeStringToMethod : MonoBehaviour | |
{ | |
/// <summary> | |
/// 関数,呼出までの遅延秒数 | |
/// </summary> | |
/// <param name="action">Action.</param> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System; | |
using System.Collections; | |
public class ArgumentChangeStringToMethodSample : ArgumentChangeStringToMethod | |
{ | |
void Start () | |
{ | |
Invoke (CallTestInvoke, 1); | |
InvokeRepeating (CallTestInvoke, 2, 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class EndMonoBehaviour : MonoBehaviour | |
{ | |
bool isApplicationQuit = false; | |
private void OnApplicationQuit() | |
{ | |
isApplicationQuit = true; |