LogAlways() public static method

Logs a message to the console, regardless of log_verbosity settings
public static LogAlways ( string format ) : void
format string
return void
示例#1
0
        public static void LogStackTrace(LogType type = LogType.Message)
        {
            var stackTrace = new System.Diagnostics.StackTrace(true);

            Debug.LogAlways("Stack trace:");
            for (int i = 1; i < stackTrace.FrameCount; i++)
            {
                var frame = stackTrace.GetFrame(i);

                var method   = frame.GetMethod();
                var fileName = frame.GetFileName() ?? "<unknown>";

                Debug.Log("  at {0}.{1}.{2} () in {3}:{4}", type, method.DeclaringType.Namespace, method.DeclaringType.Name, method.Name, fileName, frame.GetFileLineNumber());
            }
        }
示例#2
0
        /// <summary>
        /// Spawns a new entity
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entityName"></param>
        /// <param name="pos"></param>
        /// <param name="rot"></param>
        /// <param name="scale"></param>
        /// <param name="autoInit"></param>
        /// <param name="flags"></param>
        /// <returns></returns>
        public static T Spawn <T>(string entityName, Vec3?pos = null, Quat?rot = null, Vec3?scale = null, bool autoInit = true, EntityFlags flags = EntityFlags.CastShadow, params object[] args) where T : Entity, new()
        {
            var entity = Spawn(entityName, typeof(T).Name, pos, rot, scale, autoInit, flags, args);

            if (entity == null)
            {
                return(null);
            }

            var entityT = entity as T;

            if (entityT == null)
            {
                Debug.LogAlways("[Entity.Spawn<T>] Spawn was successful, but type could not be casted to type {0}", typeof(T).Name);
            }

            return(entityT);
        }
示例#3
0
        /// <summary>
        /// Spawns a new entity
        /// </summary>
        /// <param name="entityName"></param>
        /// <param name="className"></param>
        /// <param name="pos"></param>
        /// <param name="rot"></param>
        /// <param name="scale"></param>
        /// <param name="autoInit"></param>
        /// <param name="flags"></param>
        /// <returns></returns>
        public static Entity Spawn(string entityName, string className, Vec3?pos = null, Quat?rot = null, Vec3?scale = null, bool autoInit = true, EntityFlags flags = EntityFlags.CastShadow)
        {
            EntityInfo info;

            var ent = NativeEntityMethods.SpawnEntity(new EntitySpawnParams {
                Name = entityName, Class = className, Pos = pos ?? new Vec3(1, 1, 1), Rot = rot ?? Quat.Identity, Scale = scale ?? new Vec3(1, 1, 1), Flags = flags
            }, autoInit, out info) as Entity;

            if (ent != null)
            {
                return(ent);
            }
            else if (info.Id != 0)
            {
                return(CreateNativeEntity(info.Id, info.IEntityPtr) as Entity);
            }

            Debug.LogAlways("[Entity.Spawn] Failed to spawn entity of class {0} with name {1}", className, entityName);
            return(null);
        }