Last active
April 18, 2018 15:53
-
-
Save todorok1/262425e5dc0c76c10c58a3e558676064 to your computer and use it in GitHub Desktop.
Unityチュートリアル・ガイドを表示するスクリプト。
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
void InstantiateGuidePrefabs(){ | |
// 『GuideParent』の位置を『Sphere』オブジェクトの位置へ移動 | |
gameObject.transform.position = player.transform.position; | |
// 『GuideParent』の位置をguidePosにセット | |
Vector3 guidePos = gameObject.transform.position; | |
// Prefabをロードする | |
GameObject guidePrefab = (GameObject)Resources.Load("Prefabs/Guide"); | |
for (int i = 0; i < prots; i++){ | |
// Prefabをインスタンス化 | |
GameObject guideObject = (GameObject)Instantiate(guidePrefab, guidePos, Quaternion.identity); | |
// インスタンス化したオブジェクトをGuideParentの子オブジェクトにする | |
guideObject.transform.SetParent(gameObject.transform); | |
// オブジェクト名を設定する | |
guideObject.name = "Guide_" + i.ToString(); | |
// リストへ追加 | |
guideList.Add(guideObject); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment