ロバメモ - 素人のUnity覚書と奮闘記

素人のUnity覚書と奮闘記

2017-10-19から1日間の記事一覧

シングルトンクラス

やりたいこと シーンをまたいで変数値を保持するクラスを作りたい。 シングルトンクラスを作る using UnityEngine; using System.Collections; public class Global : MonoBehaviour { static public Global instance; void Awake(){ if (instance == null) …

Error : You are trying to create a MonoBehaviour using the 'new' keyword.

You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all MonoBehavior…