DEV Community

loading...

TIL Unity's URL Protocol

goldenxp profile image Sunder Iyer ・2 min read

2021-02-26

To understand this problem, you need to understand that dogfooding is important. As I know it, dogfooding is when a company uses its product the way its customer would. I can say with some confidence that Unity Inc has never shipped a game to paying(?) gamers. They've made proof-of-concept demos/templates for paying(?) game developers but their product Unity is used by game developers to make products for gamers. Therefore, I believe Unity Inc has yet to eat their own dog food.


Why does this matter? Obvious pains would be discovered and fixed. I'm certain that the developers of the Unity engine/editor don't use its Package Manager at the level where they would need to sift through dozens of owned assets (perhaps to find a 3d model) to use in an actual game production.
Screenshot of the Package Manager showing my assets
The Package Manager is useful no doubt but it's terrible for finding all the animation assets you own, for example. The better option is to use a web browser and take advantage of the Asset Store's selling features to organize/sort/filter your assets. Once you find what you need, you can use the "Open in Unity" functionality to pull it into the editor.
Open in Unity button on the website
And that's fine...until the button refuses to work. You can click it as many times as you want but it'll silently fail.
There's a few reasons for this. You could be on Linux where this was a "Known Issue" for a few years. Your browser has protocol handlers disabled for safety reasons. Or you could be on Windows and your registry entry for Unity's URL Protocol got wrecked. That's what happened to me when I installed/removed multiple versions of Unity.
Anyway, the protocol is url:com.unity3d.kharma!
So if you want to open an asset like Meshtint's Little Heroes, you could invoke com.unity3d.kharma:content/67636 from your browser. The number 67636 is the product id and it's slapped on at the end of the asset's store URL.
On Windows, if your registry is setup correctly, it will pass such URLs as an argument. If there's an issue, an easy fix is to just reinstall the editor. Alternatively, run regedit and find and fix the erroneous entry. It should look like:

"<yourpath>\Editor\Unity.exe" -openurl "%1"
Enter fullscreen mode Exit fullscreen mode

Once fixed, you can click the "Open in Unity" button or make your own list of URLs and download/import what you need quickly.
Desired asset seen in Unity's Package Manager

Discussion (0)

pic
Editor guide