Advertisement
AnthonyC

Untitled

Apr 8th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class Planet : MonoBehaviour {
  4.  
  5.     // Use this for initialization
  6.     void Start () {
  7.         createDatMoon();
  8.     }
  9.    
  10.     // Update is called once per frame
  11.     void Update () {
  12.        
  13.     }
  14.  
  15.     void createDatMoon()
  16.     {
  17.         GameObject prefab = (GameObject)Resources.Load("Prefabs/Moon");
  18.  
  19.         Vector3 pos = new Vector3(0, 0, 2);
  20.  
  21.         var currentPlanet = Instantiate(prefab, pos, Quaternion.identity);
  22.         currentPlanet.transform.parent = gameObject.transform;
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement