Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using UnityEngine;
using System.Collections;
using UnityEngine.Assertions;
public class Spawn : MonoBehaviour
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
static void Init()
{
// 凄い重要なオブジェクトの生成して、staticに登録
var sio = Resources.Load ("sugoi juyou na obujekuto") as GameObject;
sioi = GameObject.Instantiate (sio);
}
static GameObject sioi = null;
void Awake()
{
Assert.IsNotNull (sioi); // Initが値を設定したのでnullではない(2周めは知らない)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.