/// /// MIT License - Copyright(c) 2019 Ugo Belfiore /// using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using System; using UnityEngine.UI; using TMPro; public static class ExtGameObject { /// /// create a gameObject, with a set of components /// ExtGameObject.CreateGameObject("game object name", Transform parent, Vector3.zero, Quaternion.identity, Vector3 Vector.One, Component [] components) /// set null at components if no component to add /// return the created gameObject /// public static GameObject CreateLocalGameObject(string name, Transform parent, Vector3 localPosition, Quaternion localRotation, Vector3 localScale) { GameObject newObject = new GameObject(name); //newObject.SetActive(true); newObject.transform.SetParent(parent); newObject.transform.SetAsLastSibling(); newObject.transform.localPosition = localPosition; newObject.transform.localRotation = localRotation; newObject.transform.localScale = localScale; return (newObject); } }