{
  "schemaVersion": "0.11.0",
  "canonical": "https://www.pystone.net/notes/uwa-answer-unity-conditional-compilation-symbols/",
  "atlas": "https://www.pystone.net/?node=uwa-answer-unity-conditional-compilation-symbols#knowledge-atlas",
  "markdown": "https://www.pystone.net/notes/uwa-answer-unity-conditional-compilation-symbols.md",
  "context": "https://www.pystone.net/notes/uwa-answer-unity-conditional-compilation-symbols.context.json",
  "knowledgeVersion": "224c990773de.5fa8af6e39fa",
  "build": {
    "siteCommit": "224c990773de166d23a886306577dd90379529ce",
    "notesCommit": "5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a",
    "builtAt": "1970-01-01T00:00:00.000Z",
    "version": "224c990773de.5fa8af6e39fa"
  },
  "id": "note:uwa-answer-unity-conditional-compilation-symbols",
  "slug": "uwa-answer-unity-conditional-compilation-symbols",
  "title": "Unity宏定义问题",
  "type": "note",
  "visibility": "public",
  "idStability": "rename-stable",
  "author": {
    "name": "石心.Yong"
  },
  "publisher": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "aliases": [],
  "summary": "Unity宏定义问题",
  "contentRole": "source",
  "sourceType": "source",
  "sourceMetadata": {
    "author": "石心.Yong"
  },
  "isMoc": false,
  "mocRecognition": "none",
  "generated": false,
  "attribution": "external_source",
  "domain": "10-计算机、信息技术与工程",
  "tags": [],
  "mocs": [],
  "contentHash": "934026024962e9cd5baebd2145896928d765dbc601f12b229b284391780a68f2",
  "assets": [],
  "headings": [
    {
      "depth": 1,
      "text": "Unity宏定义问题",
      "anchor": "unity宏定义问题",
      "citation": "https://www.pystone.net/notes/uwa-answer-unity-conditional-compilation-symbols/#unity%E5%AE%8F%E5%AE%9A%E4%B9%89%E9%97%AE%E9%A2%98"
    },
    {
      "depth": 2,
      "text": "问题",
      "anchor": "问题",
      "citation": "https://www.pystone.net/notes/uwa-answer-unity-conditional-compilation-symbols/#%E9%97%AE%E9%A2%98"
    },
    {
      "depth": 1,
      "text": "if TapTap",
      "anchor": "if-taptap",
      "citation": "https://www.pystone.net/notes/uwa-answer-unity-conditional-compilation-symbols/#if-taptap"
    },
    {
      "depth": 1,
      "text": "elif GooglePlay",
      "anchor": "elif-googleplay",
      "citation": "https://www.pystone.net/notes/uwa-answer-unity-conditional-compilation-symbols/#elif-googleplay"
    },
    {
      "depth": 1,
      "text": "elif AppStore",
      "anchor": "elif-appstore",
      "citation": "https://www.pystone.net/notes/uwa-answer-unity-conditional-compilation-symbols/#elif-appstore"
    },
    {
      "depth": 1,
      "text": "endif",
      "anchor": "endif",
      "citation": "https://www.pystone.net/notes/uwa-answer-unity-conditional-compilation-symbols/#endif"
    },
    {
      "depth": 2,
      "text": "我的回答",
      "anchor": "我的回答",
      "citation": "https://www.pystone.net/notes/uwa-answer-unity-conditional-compilation-symbols/#%E6%88%91%E7%9A%84%E5%9B%9E%E7%AD%94"
    },
    {
      "depth": 2,
      "text": "来源与关系",
      "anchor": "来源与关系",
      "citation": "https://www.pystone.net/notes/uwa-answer-unity-conditional-compilation-symbols/#%E6%9D%A5%E6%BA%90%E4%B8%8E%E5%85%B3%E7%B3%BB"
    }
  ],
  "claims": [],
  "outgoing": [
    {
      "id": "note:my-uwa-answers",
      "title": "我的 UWA 问答",
      "url": "https://www.pystone.net/notes/my-uwa-answers/",
      "atlas": "https://www.pystone.net/?node=my-uwa-answers#knowledge-atlas",
      "label": "我的 UWA 问答",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "上位集合：我的 UWA 问答",
      "citation": "https://www.pystone.net/notes/uwa-answer-unity-conditional-compilation-symbols/#%E6%9D%A5%E6%BA%90%E4%B8%8E%E5%85%B3%E7%B3%BB"
    }
  ],
  "incoming": [
    {
      "id": "note:my-uwa-answers",
      "title": "我的 UWA 问答",
      "url": "https://www.pystone.net/notes/my-uwa-answers/",
      "atlas": "https://www.pystone.net/?node=my-uwa-answers#knowledge-atlas",
      "label": "我的 UWA 问答",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "2021-05-07：Unity宏定义问题（引擎技术）",
      "citation": "https://www.pystone.net/notes/my-uwa-answers/#2021"
    },
    {
      "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": "我的UWA问答中的“2021-05-07 - Unity宏定义问题”导航项",
      "citation": "https://www.pystone.net/notes/game-graphics-and-runtime/#%E6%88%91%E7%9A%84uwa%E9%97%AE%E7%AD%94"
    }
  ],
  "contentMarkdown": "# Unity宏定义问题\n\n> [!note] 我的 UWA 问答\n> 本文收录我在 UWA 问答发表的公开回答。问题内容归原提问者；回答保留当时语境，技术结论可能受 Unity 版本、平台和项目条件限制。\n\n## 问题\n\n执行代码添加宏定义\n\n```\nPlayerSettings.SetScriptingDefineSymbolsForGroup(buildTarget, names);\n```\n\n然后执行代码打印宏定义\n\n```\nstring defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);\n```\n\n```\nDebuger.Log(\"宏定义：\" + defineSymbols);\n```\n\n上面输出的宏定义是自己要的。\n\n但是通过#if判断宏定义 获取的还是之前的\n\n# if TapTap\n\n```\nchannelType = ChannelType.TapTap;\n```\n\n# elif GooglePlay\n\n```\nchannelType = ChannelType.GooglePlay;\n```\n\n# elif AppStore\n\n```\nchannelType = ChannelType.AppStore;\n```\n\n# endif\n\n我这些都是在Editor下操作的， 执行过AssetDatabase.Refresh();也没有作用\n\n- 提问者：路人甲\n- 提问时间：2021-05-07 20:31:10\n\n## 我的回答\n\n在Editor下Refresh不行，Reimport才行。并且Editor下的宏定义设置，与当前的activeBuildTarget一致。\n\n- 回答时间：2021-05-07 21:45:28\n- 最后更新：2021-09-26 23:48:55\n- 采纳状态：未采纳\n\n## 来源与关系\n\n- 上位集合：[[10-计算机、信息技术与工程/05-游戏图形与运行时/我的UWA问答/我的UWA问答|我的 UWA 问答]]\n- UWA 标签：引擎技术\n- 原始问题：[Unity宏定义问题](https://answer.uwa4d.com/question/6094c28e6bb31032f9791518)\n- 源页最后更新：2021-05-08 18:18:47\n"
}
