Exemplo n.º 1
0
        /// <summary>
        /// Instantiate Object
        /// </summary>
        /// <param name="original"></param>
        /// <returns></returns>
        public static GameObject Instantiate(GameObject original)
        {
            GameObject clone = GameObject.Instantiate(original);

#if UNITY_EDITOR
            LuaHelper.RefreshShader(clone as GameObject);
#endif
            return(clone);
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="original"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        public static GameObject InstantiateGlobal(GameObject original, GameObject parent = null)
        {
            var        tranformTa = original.transform;
            var        pos        = tranformTa.position;
            Quaternion rota       = tranformTa.rotation;
            Vector3    scale      = tranformTa.localScale;
            GameObject clone      = (GameObject)GameObject.Instantiate(original);

#if UNITY_EDITOR
            if (clone is GameObject)
            {
                LuaHelper.RefreshShader(clone as GameObject);
            }
#endif
            var transform = clone.transform;
            if (parent != null)
            {
                clone.transform.SetParent(parent.transform);
            }
            transform.position   = pos;
            transform.localScale = scale;
            transform.rotation   = rota;
            return(clone);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Saves the persistent file.
 /// </summary>
 /// <param name="context">Context.</param>
 /// <param name="fileName">File name.</param>
 public static void SavePersistentFile(string context, string fileName)
 {
     byte[] cont = LuaHelper.GetBytes(context);
     SavePersistentFile(cont, fileName);
 }