vrchat-community / creator-companion

The Entry Point for Making Things in VRChat
https://vrchat.com/home/download
64 stars 449 forks source link

[BUG] vpm command cannot find Unity on macOS #28

Open anatawa12 opened 1 year ago

anatawa12 commented 1 year ago

Describe the bug vpm check unity says Found No Editors even if I've installed Unity via UnityHub.

To Reproduce

  1. install Unity via UnityHub
  2. run vpm check unity

Expected behavior VPM command should see the Unity installed via UnityHub.

Screenshots

image

Desktop (please complete the following information):

Additional context

TheButlah commented 1 year ago

Did you find a workaround? Any idea where vpm stores the unity path?

TheButlah commented 1 year ago

solved it, see my issue.

Faxmashine commented 1 year ago

Here are some duplicate issues (now closed): https://github.com/vrchat-community/creator-companion/issues/41 https://github.com/vrchat-community/creator-companion/issues/46

@TheButlah was able to use a workaround:

I was able to solve this by manually providing the path to the unity executable.

On macos, the vpm settings that store the paths are at: ~/.local/share/VRChatCreatorCompanion/settings.json In that file, there is a "pathToUnityExe": "",, replace this empty string with the unity executable path.

On macos, the unity executable is at: /Applications/Unity/Hub/Editor/2019.4.31f1/Unity.app/Contents/MacOS/unity

kurotu commented 1 year ago

I think it's not workaround. When using the command, we expects vpm automatically detects unity editors WITHOUT knowledge of editor path. If we already know "pathToUnityExe", it is enough for us to check whether the file exists. vpm check unity will be no longer needed.

And even when "pathToUnityExe" is set, vpm list unity can't list unity editors as described in #46. In CLI docs, vpm should use Unity Hub's output of -- --headless editors -i, but actually failed.

anatawa12 commented 1 year ago

Setting pathToUnityExe is working as a workaround for me.

valentinegb commented 4 months ago

Alright, I don't mean to sound hostile but this has been a problem since 2022 and it is now 2024 and that is ridiculous. Workarounds are good of course (The workaround doesn't seem to work anymore, anytime you use vpm, settings.json is overridden), but I expected this to be totally resolved by now.

orels1 commented 4 months ago

@valentinegb hey! I'm sorry to hear that you're still facing this issue. Can you post the screenshot of what the result of running vpm check unity is for you? (I need the exact log messages so I can look things up in the code). Or better yet - the latest log file in the ~/.local/share/VRChatCreatorCompanion/Logs` folder.

You can also try putting your editor path into the unityEditors array in your settings.json and then running a command like vpm list projects or vpm list unity which should run some backwards-compatibility sync on the settings. And see if that helps the check pass.

valentinegb commented 4 months ago

Oddly, I didn't see any logs at all at ~/.local/share/VRChatCreatorCompanion/Logs, but this is the output of vpm check unity:

[10:12:58 INF] Found No Supported Editors
[10:12:58 INF] Unity is not installed.

After that I modified my settings.json like so:

diff --git a/settings.json b/settings.json
index 764af2c..318abf1 100644
--- a/settings.json
+++ b/settings.json
@@ -1,5 +1,5 @@
 {
-  "pathToUnityExe": "",
+  "pathToUnityExe": "/Applications/Unity/Hub/Editor/2022.3.22f1/Unity.app/Contents/MacOS/Unity",
   "pathToUnityHub": "/Applications/Unity Hub.app/Contents/MacOS/Unity Hub",
   "userProjects": [],
   "unityEditors": [],

After running vpm list projects, settings.json was reverted to its previous state and this was the output:


╭────────────┬────────────────────────────────┬────────────────────────────────╮
│ Path       │ Unity Version                  │ Last Modified                  │
╰────────────┴────────────────────────────────┴────────────────────────────────╯

Once again, no logs. Modifying settings.json again and then running vpm list unity, again reverts settings.json and outputs the following (without logs):

[10:25:34 INF] Found No Supported Editors
[10:25:34 INF] Found 0 Unity Installations.

╭────────────────────┬─────────────────────────────────────────────────────────╮
│ Path               │ Unity Version                                           │
╰────────────────────┴─────────────────────────────────────────────────────────╯
orels1 commented 4 months ago

can you please put the path to your unity into the unityEditors array instead of pathToUnityExe? e.g.

 "unityEditors": ["/Applications/Unity/Hub/Editor/2022.3.22f1/Unity.app/Contents/MacOS/Unity"],

and then run vpm list projects and then vpm list unity

valentinegb commented 4 months ago

Oh, my bad! Did that, vpm list projects outputs:


╭────────────┬────────────────────────────────┬────────────────────────────────╮
│ Path       │ Unity Version                  │ Last Modified                  │
╰────────────┴────────────────────────────────┴────────────────────────────────╯

vpm list unity outputs:

[11:40:49 INF] Found 1 Unity Installations.

╭────────┬─────────────────────────────────────────────────────────────────────╮
│ Path   │ Unity Version                                                       │
├────────┼─────────────────────────────────────────────────────────────────────┤
│ 2022.3 │ /Applications/Unity/Hub/Editor/2022.3.22f1/Unity.app/Contents/MacOS │
│ .22f1  │ /Unity                                                              │
╰────────┴─────────────────────────────────────────────────────────────────────╯

So, I think that worked! Still no logs though, if you still need that.

orels1 commented 4 months ago

@valentinegb does vpm check unity pass now? 👀

Also seems like the headers on the unity list are flipped, huh.

We also have an upcoming fix for https://github.com/vrchat-community/creator-companion/issues/504 will help the automatic version lookup. The current timeout was way too low due to it freezing the UI of the original Creator Companion (pre 2.x)

valentinegb commented 4 months ago

@valentinegb does vpm check unity pass now? 👀

Sure does :>

[12:59:08 INF] Unity is installed.
orels1 commented 3 months ago

Ok thank you! I think I will close this issue when we ship a fix for #504 And probably note the potential workaround in the documentation for the VPM CLI. If this problem comes up again after that - please don't hesitate to make another issue!

orels1 commented 3 months ago

We just released the VPM CLI update, version 0.1.26.

It should hopefully address the root cause of the scanning issues, I will close this after I add documentation for the potential workaround in case there is something else at play

rickythewoof commented 3 months ago

Heya! I've updated the editor with the dotnet cli. I'm on linux. Manually adding the executable in PathToUnityExe or UnityEditors doen't make a change for me.

I've put ~/Unity/Hub/Editor/2022.3.22f1/Editor/Unity (with quotes), but running vpm list projects and then vpm list unity doesn't still make the Editor appear. The file gets rolled back every time i run any kind of vpm command

I do not have logs available (Folder previously mentioned is present, but empty)

image

image

anatawa12 commented 3 months ago

the ~ char will not be expanded to home dir with VCC. ~ to home dir expantion is a feature of shell so could you try absolute path , that starts with /.

rickythewoof commented 3 months ago

the ~ char will not be expanded to home dir with VCC.

Unfortunately changing it to the absolute path did not change the outcome of it. seems like it sort of has a ~ expansion, since pathToUnityHub works and a check on hub correctly displays theunity hub version. I've tried to change that path too to an absolute path, before adding unityEditors again, but it's still not working

orels1 commented 3 months ago

The file gets rolled back every time i run any kind of vpm command

Could you delete the vcc.liteDb file for me, then add the editor to unityEditors array (not pathToUnityExe, leave that empty), and then run vpm list projects?

It is very bizzare that it would silently clear a unityEditors array without migrating it to the DB.

If possible, I would also ask to run OneBella on the vcc.liteDb after you run the vpm list projects to see what is stored in the unityEditors table (if anything)

rickythewoof commented 2 months ago

after deleting the vcc.liteDb file and adding the editor as asked, and running first vpm list projects and then vpm list unity I still don't get any unity installation..it's weird. Using OneBella on the file just returns a barebone db:

SELECT * FROM projects LIMIT 100

--  UPDATE projects
--  SET <key0> = <exprValue0> [,<keyN> = <exprValueN>] | <newDoc>
--  [ WHERE <filterExpr> ]

--  INSERT INTO projects[: {autoIdType}]
--  VALUES {doc0} [, {docN}]

-- DELETE projects WHERE <filterExpr>

the settings.json file still gets reset