unity.webp icon indicating copy to clipboard operation
unity.webp copied to clipboard

the name 'unsafe' does not exist in current context

Open strangeways-dev opened this issue 3 years ago • 1 comments
trafficstars

The package is not working even after following the installation instructions from the openUPM: https://openupm.com/packages/com.netpyoung.webp/#modal-manualinstallation

Here's what I get in the console after installing the package:

Library\PackageCache\[email protected]\Runtime\NativeLibwebpdemux.cs(112,17): error CS0103: The name 'Unsafe' does not exist in the current context Library\PackageCache\[email protected]\Runtime\NativeLibwebpdemux.cs(141,17): error CS0103: The name 'Unsafe' does not exist in the current context

How can I fix this?

strangeways-dev avatar Oct 06 '22 15:10 strangeways-dev

hi @imineti

For package install needs System.Runtime.CompilerServices.Unsafe.dll.

But rather than use .package to install unity.webp, I recommand to use upm

You can find manifest.json from {gameproject}/Packages/manifest.json. than modify to add

{
  "dependencies": {
    "com.netpyoung.webp": "https://github.com/netpyoung/unity.webp.git?path=unity_project/Assets/unity.webp#0.3.9",
    "org.nuget.system.runtime.compilerservices.unsafe": "6.0.0"
  },
  "scopedRegistries": [
    {
      "name": "Unity NuGet",
      "url": "https://unitynuget-registry.azurewebsites.net",
      "scopes": [
        "org.nuget"
      ]
    }
  ]
}

https://github.com/netpyoung/unity.webp#using-upm

netpyoung avatar Oct 06 '22 17:10 netpyoung