Advertisement
LittleAngel

CreateGameObject

Jun 14th, 2013
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class CreateGameObject : MonoBehaviour {
  5.  
  6. public GameObject parentObject;
  7. public Transform grandParent;
  8.  
  9. // Use this for initialization
  10. void Start () {
  11. GameObject myGameObject = new GameObject();
  12. myGameObject.name = "Child";
  13. myGameObject.transform.localScale = new Vector3 (10, 10, 10);
  14. myGameObject.AddComponent<Light>();
  15. myGameObject.transform.parent = parentObject.transform;
  16. parentObject.transform.parent = grandParent;
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement