---
# System prepended metadata

title: Unity Dll x86 跟 x86_64 匯入的坑
tags: [Unity]

---

# Unity Windows DLL x86 跟 x86_64 匯入的坑

## 修改 x86 dll 的 .meta 檔案

**一定要先關閉 Unity 專案再改, 改完再重開 Unity 專案。**

替換 PluginImporter 參數為以下：
```
PluginImporter:
  externalObjects: {}
  serializedVersion: 2
  iconMap: {}
  executionOrder: {}
  isPreloaded: 0
  isOverridable: 0
  platformData:
  - first:
      '': Any
    second:
      enabled: 0
      settings:
        Exclude Android: 1
        Exclude Editor: 0
        Exclude Linux: 0
        Exclude Linux64: 0
        Exclude LinuxUniversal: 0
        Exclude OSXUniversal: 0
        Exclude Win: 0
        Exclude Win64: 1
        Exclude iOS: 1
  - first:
      '': OSXIntel
    second:
      enabled: 1
      settings:
        CPU: AnyCPU
  - first:
      '': OSXIntel64
    second:
      enabled: 0
      settings:
        CPU: None
  - first:
      Android: Android
    second:
      enabled: 0
      settings:
        CPU: ARMv7
  - first:
      Any: 
    second:
      enabled: 0
      settings: {}
  - first:
      Editor: Editor
    second:
      enabled: 1
      settings:
        CPU: x86
        DefaultValueInitialized: true
        OS: AnyOS
  - first:
      Facebook: Win
    second:
      enabled: 1
      settings:
        CPU: AnyCPU
  - first:
      Facebook: Win64
    second:
      enabled: 0
      settings:
        CPU: None
  - first:
      Standalone: Linux
    second:
      enabled: 1
      settings:
        CPU: x86
  - first:
      Standalone: Linux64
    second:
      enabled: 1
      settings:
        CPU: None
  - first:
      Standalone: LinuxUniversal
    second:
      enabled: 1
      settings:
        CPU: AnyCPU
  - first:
      Standalone: OSXUniversal
    second:
      enabled: 1
      settings:
        CPU: x86
  - first:
      Standalone: Win
    second:
      enabled: 1
      settings:
        CPU: AnyCPU
  - first:
      Standalone: Win64
    second:
      enabled: 0
      settings:
        CPU: None
  - first:
      iPhone: iOS
    second:
      enabled: 0
      settings:
        CompileFlags: 
        FrameworkDependencies: 
  userData: 
  assetBundleName: 
  assetBundleVariant: 
```
| Editor x86 |Standalone x86 |
|:-:|:-:|
| ![image](https://hackmd.io/_uploads/B1WbYU1bC.png) | ![image](https://hackmd.io/_uploads/rJ-zY8ybR.png) |

---

## 修改 x86_64 dll 的 .meta 檔案

**一定要先關閉 Unity 專案再改, 改完再重開 Unity 專案。**

替換 PluginImporter 參數為以下：
```
PluginImporter:
  externalObjects: {}
  serializedVersion: 2
  iconMap: {}
  executionOrder: {}
  isPreloaded: 0
  isOverridable: 0
  platformData:
  - first:
      '': Any
    second:
      enabled: 0
      settings:
        Exclude Android: 1
        Exclude Editor: 0
        Exclude Linux: 0
        Exclude Linux64: 0
        Exclude LinuxUniversal: 0
        Exclude OSXUniversal: 0
        Exclude Win: 1
        Exclude Win64: 0
        Exclude iOS: 1
  - first:
      '': OSXIntel
    second:
      enabled: 0
      settings:
        CPU: None
  - first:
      '': OSXIntel64
    second:
      enabled: 1
      settings:
        CPU: AnyCPU
  - first:
      Android: Android
    second:
      enabled: 0
      settings:
        CPU: ARMv7
  - first:
      Any: 
    second:
      enabled: 0
      settings: {}
  - first:
      Editor: Editor
    second:
      enabled: 1
      settings:
        CPU: x86_64
        DefaultValueInitialized: true
        OS: AnyOS
  - first:
      Facebook: Win
    second:
      enabled: 0
      settings:
        CPU: None
  - first:
      Facebook: Win64
    second:
      enabled: 1
      settings:
        CPU: AnyCPU
  - first:
      Standalone: Linux
    second:
      enabled: 1
      settings:
        CPU: None
  - first:
      Standalone: Linux64
    second:
      enabled: 1
      settings:
        CPU: x86_64
  - first:
      Standalone: LinuxUniversal
    second:
      enabled: 1
      settings:
        CPU: AnyCPU
  - first:
      Standalone: OSXUniversal
    second:
      enabled: 1
      settings:
        CPU: x86_64
  - first:
      Standalone: Win
    second:
      enabled: 0
      settings:
        CPU: None
  - first:
      Standalone: Win64
    second:
      enabled: 1
      settings:
        CPU: AnyCPU
  - first:
      iPhone: iOS
    second:
      enabled: 0
      settings:
        CompileFlags: 
        FrameworkDependencies: 
  userData: 
  assetBundleName: 
  assetBundleVariant: 
```

| Editor x86_64 |Standalone x86_64 |
|:-:|:-:|
| ![image](https://hackmd.io/_uploads/B1g0FUyWA.png) | ![image](https://hackmd.io/_uploads/H1RAY8ybA.png) |