Skip to content

Instantly share code, notes, and snippets.

@mao-test-h
mao-test-h / SingletonMonoBehaviour.cs
Created July 26, 2017 03:05
Unity向け シングルトン基底クラス(MonoBehaviour継承)
using UnityEngine;
namespace Singleton
{
/// <summary>
/// シングルトン基底クラス(MonoBehaviour継承)
/// </summary>
public abstract class SingletonMonoBehaviour<T> : MonoBehaviour where T : SingletonMonoBehaviour<T>
{
static T instance;
@mao-test-h
mao-test-h / Singleton.cs
Created July 26, 2017 03:03
Unity向け シングルトン基底クラス(MonoBehaviour非継承)
namespace Singleton
{
/// <summary>
/// シングルトン基底クラス(MonoBehaviour非継承)
/// </summary>
public abstract class Singleton<T> where T : class, new()
{
public static readonly T Instance = new T();
}
}
@mao-test-h
mao-test-h / Debug.cs
Last active October 24, 2018 09:55
条件付きのUnityEngine.Debugクラス
#if DEBUG_OVERWRAP
using UnityEngine;
using System.Diagnostics;
using UnityDebug = UnityEngine.Debug;
using UnityObject = UnityEngine.Object;
/// <summary>
/// 条件付きのUnityEngine.Debugクラス
/// </summary>
@mao-test-h
mao-test-h / RotateCubeTest.cs
Created June 4, 2017 04:14
Cubeを接地した状態で回転させる方法について
using System.Collections;
using UnityEngine;
public class RotateCubeTest : MonoBehaviour
{
const float RotatingSpeed = 0.2f;
const float RotatingAngle = 90f;
Vector3 halfSize;
float time = 0f;
Vector3 axis = Vector3.zero;