{
  "schemaVersion": "0.11.0",
  "canonical": "https://www.pystone.net/notes/unity-engine-research-tips/",
  "atlas": "https://www.pystone.net/?node=unity-engine-research-tips#knowledge-atlas",
  "markdown": "https://www.pystone.net/notes/unity-engine-research-tips.md",
  "context": "https://www.pystone.net/notes/unity-engine-research-tips.context.json",
  "knowledgeVersion": "224c990773de.5fa8af6e39fa",
  "build": {
    "siteCommit": "224c990773de166d23a886306577dd90379529ce",
    "notesCommit": "5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a",
    "builtAt": "1970-01-01T00:00:00.000Z",
    "version": "224c990773de.5fa8af6e39fa"
  },
  "id": "note:unity-engine-research-tips",
  "slug": "unity-engine-research-tips",
  "title": "研究Unity引擎的技巧",
  "type": "note",
  "visibility": "public",
  "idStability": "rename-stable",
  "author": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "publisher": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "aliases": [],
  "summary": "研究Unity引擎的技巧",
  "contentRole": "unspecified",
  "isMoc": false,
  "mocRecognition": "none",
  "generated": false,
  "attribution": "unspecified",
  "domain": "10-计算机、信息技术与工程",
  "tags": [],
  "mocs": [],
  "contentHash": "a25bc5dbfd1371caccd838a8e268b453cc78a8b3e3739089b784b3fde0115bfd",
  "assets": [],
  "headings": [
    {
      "depth": 1,
      "text": "研究Unity引擎的技巧",
      "anchor": "研究unity引擎的技巧",
      "citation": "https://www.pystone.net/notes/unity-engine-research-tips/#%E7%A0%94%E7%A9%B6unity%E5%BC%95%E6%93%8E%E7%9A%84%E6%8A%80%E5%B7%A7"
    },
    {
      "depth": 2,
      "text": "监听Unity编辑器关闭的事件",
      "anchor": "监听unity编辑器关闭的事件",
      "citation": "https://www.pystone.net/notes/unity-engine-research-tips/#%E7%9B%91%E5%90%ACunity%E7%BC%96%E8%BE%91%E5%99%A8%E5%85%B3%E9%97%AD%E7%9A%84%E4%BA%8B%E4%BB%B6"
    }
  ],
  "claims": [],
  "outgoing": [],
  "incoming": [
    {
      "id": "note:game-graphics-and-runtime",
      "title": "游戏图形与运行时",
      "url": "https://www.pystone.net/notes/game-graphics-and-runtime/",
      "atlas": "https://www.pystone.net/?node=game-graphics-and-runtime#knowledge-atlas",
      "label": "游戏图形与运行时",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "Unity中的“研究Unity引擎的技巧”导航项",
      "citation": "https://www.pystone.net/notes/game-graphics-and-runtime/#unity"
    }
  ],
  "contentMarkdown": "# 研究Unity引擎的技巧\n\n> 创建时间：2020/6/4 11:12\n\n参考:\nhttps://www.xuanyusong.com/archives/4263（获取资源内存和硬盘大小)\n\nUnity Editor实现的一些功能，调用了Editor本身的一些函数。这些函数可能没有作为API提供出来。如果想要调用，可以看Editor的源码：用dnSpy反编译一下，找到相关的代码与函数。\n然后利用反射，根据函数名调用相应函数。\n\n此外，该方法提供了一个思路：想要深入理解UnityEditor的实现，就多看看Editor的包文件，反编译看看源码。一个是顺藤摸瓜，看相应功能的实现。一个是看包的整体结构组织，了解各个模块的功能以及实现，理解模块之间的关系。\nd\n一个小工具（用来调用内部函数）：\n\n```csharp\nclass Program\n{\n    static void Main(string[] args)\n    {\n        dynamic dyn = 1;\n        object obj = 1;\n        dyn = dyn + 3;\n        //obj = obj + 3; 报错\n\n        // Rest the mouse pointer over dyn and obj to see their\n        // types at compile time.\n        System.Console.WriteLine(dyn.GetType());\n        System.Console.WriteLine(obj.GetType());\n    }\n}\n\n```\n```csharp\nclass Program\n{\n    static void Main(string[] args)\n    {\n        dynamic dyn = 1;\n        object obj = 1;\n        dyn = dyn + 3;\n        //obj = obj + 3; 报错\n\n        // Rest the mouse pointer over dyn and obj to see their\n        // types at compile time.\n        System.Console.WriteLine(dyn.GetType());\n        System.Console.WriteLine(obj.GetType());\n    }\n}\n\n```\n\n## 监听Unity编辑器关闭的事件\n\n```csharp\nclass Program\n{\n    static void Main(string[] args)\n    {\n        dynamic dyn = 1;\n        object obj = 1;\n        dyn = dyn + 3;\n        //obj = obj + 3; 报错\n\n        // Rest the mouse pointer over dyn and obj to see their\n        // types at compile time.\n        System.Console.WriteLine(dyn.GetType());\n        System.Console.WriteLine(obj.GetType());\n    }\n}\n\n```\n"
}
