Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files in packages folder not opened to correct path. #174

Open
hunterhunted opened this issue Nov 25, 2019 · 0 comments
Open

Files in packages folder not opened to correct path. #174

hunterhunted opened this issue Nov 25, 2019 · 0 comments

Comments

@hunterhunted
Copy link

The project folder includes a 'Packages' subfolder now to see the contents of installed packages.

The path it reports with AssetDatabase.GetAssetPath isn't where the actual package items are stored, so when doubleclicking a script in a package VSCode opens a new blank file with unsaved changes instead of viewing the actual contents of the script.

To get the path where the item exists (the one that opens when you right click and choose 'Show in Explorer'), the Path.GetFullPath() method can be used as per https://docs.unity3d.com/Manual/upm-assets.html#GetFullPath

To get it working for me, I've replaced
string completeFilepath = appPath + Path.DirectorySeparatorChar + AssetDatabase.GetAssetPath(selected);
with
string completeFilepath = Path.GetFullPath(selectedFilePath);
in the OnOpenedAsset callback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant