Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class CreateGameObject : MonoBehaviour {
- public GameObject parentObject;
- public Transform grandParent;
- // Use this for initialization
- void Start () {
- GameObject myGameObject = new GameObject();
- myGameObject.name = "Child";
- myGameObject.transform.localScale = new Vector3 (10, 10, 10);
- myGameObject.AddComponent<Light>();
- myGameObject.transform.parent = parentObject.transform;
- parentObject.transform.parent = grandParent;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement