Exemplo n.º 1
0
		/// <summary>
		/// Prints a UnityEngine.GameObject, along with its components and children. Prints properties of components, but not of GameObjects, and doesn't print GameObjects in properties.
		/// </summary>
		/// <param name="o">The game object to print</param>
		/// <param name="componentFilter">A filter that says which components to print fully (printing their properties). By default, all will be expanded.</param>
		/// <param name="gameObjectFilter">A filter that says which GameObject children to print recursively (e.g. print their components and their children). Only the names of filtered children will appear.</param>
		/// <returns></returns>
		public static string PrintUnityGameObject(GameObject o, Func<GameObject, bool> gameObjectFilter = null, Func<Component, bool> componentFilter = null) {
			componentFilter = componentFilter ?? (x => true);
			gameObjectFilter = gameObjectFilter ?? (x => true);
			var dumper = new UnityObjectDumper();
			var strWriter = new StringWriter();
			var identedWriter = new IndentedTextWriter(strWriter, "\t");
			dumper.PrintUnityGameObject(o, identedWriter,gameObjectFilter, componentFilter);
			identedWriter.Flush();
			strWriter.Flush();
			return strWriter.ToString();
		}
Exemplo n.º 2
0
        /// <summary>
        /// Prints a UnityEngine.GameObject, along with its components and children. Prints properties of components, but not of GameObjects, and doesn't print GameObjects in properties.
        /// </summary>
        /// <param name="o">The game object to print</param>
        /// <param name="componentFilter">A filter that says which components to print fully (printing their properties). By default, all will be expanded.</param>
        /// <param name="gameObjectFilter">A filter that says which GameObject children to print recursively (e.g. print their components and their children). Only the names of filtered children will appear.</param>
        /// <returns></returns>
        public static string PrintUnityGameObject(GameObject o, Func <GameObject, bool> gameObjectFilter = null, Func <Component, bool> componentFilter = null)
        {
            componentFilter  = componentFilter ?? (x => true);
            gameObjectFilter = gameObjectFilter ?? (x => true);
            var dumper        = new UnityObjectDumper();
            var strWriter     = new StringWriter();
            var identedWriter = new IndentedTextWriter(strWriter, "\t");

            dumper.PrintUnityGameObject(o, identedWriter, gameObjectFilter, componentFilter);
            identedWriter.Flush();
            strWriter.Flush();
            return(strWriter.ToString());
        }