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

launching unity.exe without unity hub starting in background #95

Closed
1 of 4 tasks
unitycoder opened this issue Oct 5, 2022 · 11 comments
Closed
1 of 4 tasks

launching unity.exe without unity hub starting in background #95

unitycoder opened this issue Oct 5, 2022 · 11 comments
Labels
enhancement New feature or request

Comments

@unitycoder
Copy link
Owner

unitycoder commented Oct 5, 2022

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

references (no workarounds)

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
  • test what happens if uninstall unity hub *cannot login or access asset store packages, can use unity as signed out user
@unitycoder unitycoder added the enhancement New feature or request label Oct 5, 2022
@unitycoder
Copy link
Owner Author

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

@Novack
Copy link

Novack commented Oct 13, 2022

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.

@unitycoder
Copy link
Owner Author

unitycoder commented Oct 27, 2022

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
Copy link
Owner Author

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

@otri
Copy link

otri commented Oct 28, 2023

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.

@unitycoder
Copy link
Owner Author

Good idea, hub apparently supports those unity proxy environment values

HTTP_PROXY = http://username:password@proxy.domain.com:port
HTTPS_PROXY = http://username:password@proxy.domain.com: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
Copy link
Owner Author

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
Copy link
Owner Author

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..)

@Novack
Copy link

Novack commented Jan 10, 2024

Thank you for looking into it.

@unitycoder
Copy link
Owner Author

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
Copy link
Owner Author

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)

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

No branches or pull requests

3 participants