Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using UnityEngine;
- using UnityInjector;
- using UnityInjector.Attributes;
- namespace CM3D2GameObjcetDumpListPlugin
- {
- [PluginFilter("CM3D2x64"),
- PluginFilter("CM3D2x86"),
- PluginName("GameObjcet Dump List Plugin"),
- PluginVersion("1.0.0.0")]
- public class GameObjcetDumpList : PluginBase
- {
- private int sceneLevel = -1;
- private bool execituig = false;
- void Awake()
- {
- GameObject.DontDestroyOnLoad(this);
- }
- void OnLevelWasLoaded(int level)
- {
- sceneLevel = level;
- }
- void Update()
- {
- if ((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) && Input.GetKey(KeyCode.L))
- {
- if (!execituig)
- {
- execituig = true;
- DumpList();
- }
- }
- else
- {
- execituig = false;
- }
- }
- private void DumpList()
- {
- GameObject[] rootArray = Array.FindAll(UnityEngine.Object.FindObjectsOfType<GameObject>(),(item) => item.transform.parent == null);
- String now = DateTime.Now.ToString("yyyyMMdd_HHmmss");
- string filename = (@".\MaidObjectList_Level_" + sceneLevel.ToString() + "_" + now + ".txt");
- string rootname = "miss hit";
- ArrayList gameObjectList = new ArrayList();
- foreach (var root in rootArray)
- {
- rootname = root.name;
- gameObjectList.Add(rootname);
- foreach (Transform t in root.transform)
- {
- Search(gameObjectList, t, 1);
- }
- }
- System.IO.File.WriteAllLines(filename, gameObjectList.Cast<string>().ToArray());
- }
- private void Search(ArrayList array, Transform t, int i)
- {
- string space = new string(' ', i);
- array.Add(space + t.name);
- if (t.IsChildOf(t))
- {
- i++;
- foreach (Transform item in t)
- {
- Search(array, item, i);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement