itisnajim / SocketIOUnity

A Wrapper for socket.io-client-csharp to work with Unity.
MIT License
379 stars 65 forks source link

Include SocketIOUnity as a dependency in package.json #57

Open royibernthal opened 1 year ago

royibernthal commented 1 year ago

I created a custom package that's using SocketIOUnity. I'm now trying to add SocketIOUnity to my package.json so that it can be resolved as a dependency.

I tried this:

"dependencies": {
  "com.itisnajim.socketiounity": "https://github.com/itisnajim/SocketIOUnity.git"
}

And got the following error:

[Package Manager Window] Cannot perform upm operation: Unable to add package [https://github.com/my-package.git]:
  Package my-package@https://github.com/my-package.git has invalid dependencies or related test packages:
    com.itisnajim.socketiounity (dependency): Version 'https://github.com/itisnajim/SocketIOUnity.git' is invalid. Expected a 'SemVer' compatible value. [NotFound].
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

It seems git urls are only supported in the project manifest though.

I also tried this:

"dependencies": {
  "com.itisnajim.socketiounity": "1.1.4"
}

And got the following error:

[Package Manager Window] Cannot perform upm operation: Unable to add package [https://github.com/my-package.git]:
  Package my-package@https://github.com/my-package.git has invalid dependencies or related test packages:
    com.itisnajim.socketiounity (dependency): Package [com.itisnajim.socketiounity@1.1.4] cannot be found [NotFound].
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

Which makes sense, as I don't believe this package has been pushed to any registry that unity is fetching from.

How would you do it?

itisnajim commented 1 year ago

tbh i don't have any idea this,

editing manifest.json inside Packages folder by adding the dependency maybe should work:

{
  "dependencies": {
    "com.itisnajim.socketiounity": "https://github.com/itisnajim/SocketIOUnity.git"
  }
}

Save the manifest.json file, and the Unity Package Manager should automatically resolve and install the SocketIOUnity package, if it didn't then close and open unity. otherwise i don't know!

royibernthal commented 1 year ago

Hmm yeah of course, but each user would have to do tha, it's equivalent to installing it via the Package Manager manually via Unity. It can't really by change upon package installation, correct me if I'm wrong.

itisnajim commented 1 year ago

try doing this, and tell me if its fixed, in your dependency do edit manifest.json inside Packages folder

{
  ...
  "dependencies": {
    "com.itisnajim.socketiounity": "https://github.com/itisnajim/SocketIOUnity.git"
  }
  ...
}