Last active
January 1, 2016 19:59
-
-
Save kuanyingchou/8193828 to your computer and use it in GitHub Desktop.
This file contains 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 Main : MonoBehaviour { | |
private GameObject prefab; | |
public void Update() { | |
Debug.Log(Time.frameCount); | |
if(Time.frameCount == 5) { | |
Load(); | |
Instantiate(); | |
} | |
} | |
private void Load() { | |
Debug.Log("loading resource"); | |
prefab = (GameObject)Resources.Load("obj", typeof(GameObject)); | |
Debug.Log("done loading resource"); | |
} | |
private void Instantiate() { | |
Debug.Log("instantiating prefab"); | |
GameObject obj = | |
GameObject.Instantiate( | |
prefab, | |
Vector3.zero, | |
Quaternion.identity | |
) as GameObject; | |
Debug.Log("done instantiating prefab"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment