UnityProjectCloner icon indicating copy to clipboard operation
UnityProjectCloner copied to clipboard

Problem with opening clone

Open Applegii opened this issue 3 years ago • 6 comments

When i try to open the cloned project the loading screen opens and closes the same second i tried searching for a place to upload a video to help u better understand. https://streamable.com/tp8nko

Applegii avatar Jul 06 '21 22:07 Applegii

i managed to make it work i deleted the clone and reinstalled the package

Applegii avatar Jul 06 '21 22:07 Applegii

I've been having this issue as well but unfortunately deleting and recreating the clone did not solve it this time. Neither did restarting unity, restarting my machine, etc.

When I click "Open clone project", the unity splash screen flashes on screen for a split-second, then disappears, and nothing else happens. The same thing happens if I repeat my actions.

I should note that normally, everything functions correctly and I'm able to test my app using two Unity instances without issues. I'm unsure what changes to cause this unsolvable problem to pop up.

jconst avatar Jul 11 '21 05:07 jconst

When I take the command that UnityProjectCloner is trying to run and instead run it directly in my terminal, Unity then at least gives me this error:

image

Which I would assume is the problem in the other case too, it's just not being shown when UnityProjectCloner does it?

From skimming the UnityProjectCloner code, it's not clear if it does anything to get around the problem of the lock files that Unity creates to prevent it being opened twice. I'm not sure what can be done, though, and why UnityProjectCloner does still seem to work most of the time.

Edit: I see now, it accomplishes this by only symlinking the Assets, Packages, and ProjectSettings folders (so the lock files simply don't get copied). I'll continue looking for a solution.

jconst avatar Jul 11 '21 05:07 jconst

Found something that worked for me. (TLDR for anyone with the same problem: Kill all Unity processes in task manager, delete YourProject_clone/Temp, and open both projects at the same time from Unity Hub.)

I first tried deleting the clone's Temp folder, but was stopped because Windows told me that UnityLockfile is being used by Unity Editor. This was surprising, because I only had the original project open in Unity, not the clone. Closing that Unity window didn't help either - I opened task manager and it turned out there were several unseen instances of Unity running in the background. I suspect these were started by UnityProjectCloner via its shell commands, but then they were abandoned when the attempt to open the clone failed?

In any case, this meant they were still holding a lock on UnityLockfile, which is why I couldn't delete it. So I simply had to kill all these instances of Unity Editor in the task manager, which then allowed me to delete UnityLockfile. This is the file that makes Unity think the project is already open.

Using UnityProjectCloner's "Open Clone Project" button still failed at this point, and it caused the same problem as before (creating background instances that held onto the Lockfile). But I did the same operation above to get rid of the Lockfile again.

Finally, I found that opening both projects (original and clone) at the same time from Unity Hub worked successfully.

jconst avatar Jul 12 '21 04:07 jconst

You can just open a new hub then add the clone and click run.

I think the symlinks get messed up because when you build the clone its placed in the original project directory instead of the clone until you manually set the directory to be in the clone project folder.

bitmammoth avatar Oct 20 '21 15:10 bitmammoth

You can just open a new hub then add the clone and click run.

Yes, this is what works for me now. I just never touch the project cloner menu and everything works fine. But, if you've been using the project cloner menu to open the clone and it's been failing, then you'll have those background Unity instances causing problems. So that's the situation when you need a fix like what I described. But from then on you can just open the clone project from Unity Hub.

jconst avatar Oct 20 '21 20:10 jconst

Thank you arkms!

hwaet avatar Nov 06 '22 06:11 hwaet