示例#1
0
        public static GameObject GetRoot(GStylizedTerrain terrain, GameObject prototype)
        {
            Transform parent = terrain.transform;
            string    name   = GetPrototypeRootName(prototype);

            Transform t = parent.Find(name);

            if (t == null)
            {
                GameObject g = new GameObject(name);
                g.transform.parent = parent;
                GUtilities.ResetTransform(g.transform, parent);
                t = g.transform;

                GObjectHelper oh = g.AddComponent <GObjectHelper>();
                oh.Terrain = terrain;
            }
            return(t.gameObject);
        }
 private void OnEnable()
 {
     instance = target as GObjectHelper;
 }