UnityLauncherPro icon indicating copy to clipboard operation
UnityLauncherPro copied to clipboard

launching unity.exe without unity hub starting in background

Open unitycoder opened this issue 1 year ago • 2 comments

could check why hub starts and if it can be avoided? (without uninstalling unity hub).

references (no workarounds)

  • https://forum.unity.com/threads/hub-running-in-background.690490/
  • https://forum.unity.com/threads/unity-hub-faq.610594/
  • https://forum.unity.com/threads/unityhub-make-unity-crash-on-launch-with-my-projects.516688/#post-3387257

todo

  • [ ] check why hub starts (what launches it when editor.exe starts)
  • [ ] check if can avoid it
  • [ ] check if can just kill hub process after editor runs
  • [x] test what happens if uninstall unity hub *cannot login or access asset store packages, can use unity as signed out user

unitycoder avatar Oct 05 '22 11:10 unitycoder

notes

unity project starts

  • it creates file C:\Users\USERNAME\AppData\Roaming\UnityHub\hubInfo.json, which contains: "{"version":"3.3.0","executablePath":"D:\Program Files\Unity Hub\Unity Hub.exe"}"
  • then it launches hub with: "D:\Program Files\Unity Hub\Unity Hub.exe" "--" "--silent" "--" "-projectPath" "D:\projects\YOURPROJECT"
  • current workaround: if rename "unity hub.exe to "unity hub-asdf.exe", unity doesnt find it and no hub is launched.. but then user is not signed in and cannot signin, if click signin from editor: image

unitycoder avatar Oct 05 '22 12:10 unitycoder

Something to add to that. If you launch Unity without internet connection, it has a noticeable delay, but ends up opening nonetheless. So maybe that failsafe for offline mode can be used in our favour to bypass the Hub.

Novack avatar Oct 13 '22 10:10 Novack

tested few things,

  • logged out : hub still starts with editor
  • "-noUpm" launch arg. : hub still starts
  • project that launches into safemode : hub still starts
  • 2018.4.x : No hub starting
  • 2019.3.x : Hub starts
  • 2019.1.0a10 : Hub starts
  • https://unity3d.com/unity/alpha/2019.1.0a10 "-Hub: Sunset of the Launcher"

have to go deeper after "OneCoreUAPCommonProxyStub.dll" it tries to connect some IPC, probably hub: image

unitycoder avatar Oct 27 '22 10:10 unitycoder

Aha!

if you open fake hub IPC port "Unity-hubIPCService", unity wont launch hub! (but user is signed out.. so just need to get login working and can pass auth data?)

https://learn.microsoft.com/en-us/dotnet/standard/io/how-to-use-named-pipes-for-network-interprocess-communication

unitycoder avatar Oct 28 '22 17:10 unitycoder

Interesting, what if you proxy the data and capture the output? Might have to replace the IPC port string in one or the other executable, so you can make a proxy with the same name.

otri avatar Oct 28 '23 04:10 otri

Good idea, hub apparently supports those unity proxy environment values

HTTP_PROXY = http://username:[email protected]:port HTTPS_PROXY = http://username:[email protected]:port NO_PROXY= localhost,.domain.com,127.0.0.1 UNITY_NOPROXY= localhost,.domain.com,127.0.0.1

https://forum.unity.com/threads/request-proxy-settings-for-unity-hub.515447/#post-3444341

unitycoder avatar Oct 28 '23 08:10 unitycoder

seems that this is going to get more difficult soon (with the hub logged in requirements)

In the latest version of Unity Hub, when you sign out of your account, you will now be prompted to sign back in. This is a change from earlier versions of the Hub, which would not require you to be signed in to continue using the Hub. You will still be able to access your projects outside of the Unity Hub, even if you’re not signed in. If you’re at an organization or studio that requires you to use the Hub without being signed in, you can contact customer support to turn this off.

https://forum.unity.com/threads/sign-in-and-unity-hub.1512119/

also some info about tokens: windows credential manager UnityHub/combinedTokens https://forum.unity.com/threads/is-there-a-reason-that-i-have-to-log-in-to-unity-hub.1511060/#post-9447227

unitycoder avatar Nov 03 '23 07:11 unitycoder

closing this for now, since it would require fully "emulated hub" to work without it.. (i think its possible, but would have to reverse engineer hub sources..)

unitycoder avatar Jan 10 '24 19:01 unitycoder

Thank you for looking into it.

Novack avatar Jan 10 '24 20:01 Novack

2 ideas for the future:

  • once AI can process larger codebases easily, it could be used to extract & convert necessary parts into c#
  • or, make "Unity Hub Lite" from current hub, remove all extra parts, except license and user handling (at this point it might not even need electron, just small node.js app)

unitycoder avatar Jan 11 '24 08:01 unitycoder

adding some notes here from few tests:

  • auth.js defines IPC routes (like "connectInfo:get")
  • when editor starts, it sends message "connectInfo:get" and expects json data from getConnectInfo() *contains list of service URLS
  • ???
  • then editor probably asks for "userInfo:get" (hub replies to this with user info and accessToken) *if token is invalid, cannot access your assets in package manager
  • then editor probably asks for "orgInfo:get" (hub replies with list of your Orgs)

unitycoder avatar Apr 26 '24 12:04 unitycoder