Hi,
I want to know what file the hierarchy layout is saved in so I can include it in my .gitignore file.
I’m using the Unity .gitignore file on the github repository here (gitignore/Unity.gitignore at main · github/gitignore · GitHub)
Any help would be appreciated!
I’ve noticed this too as I regularly use two different computers for Unity. I think there’s a possibility that Unity saves this kind of information in the user’s home directory somewhere rather than on the project folder. In that case it might not be easy to do what you’re looking for. I wonder if you could achieve this with an editor script somehow though. Maybe something like an editor window that lets you paste in a git commit hash and checks out that commit, then reads a special file that contains the scene name to load and loads that Scene?
Looking through the docs again, I think it can be done through an editor script. EditorSceneManager.GetSceneManagerSetup will get the loaded state of scenes, and EditorSceneManager.RestoreSceneManagerSetup will restore their state. These both work with an array of SceneSetup objects. It looks like you could create an array of these objects and then pass them into EditorSceneManager.RestoreSceneManagerSetup to recreate the required hierarchy scene set-up. I haven’t tried this yet - but it might be a potential solution.
I was really hoping for a solution that would just ‘work’ if I got the git repository to save the required file.
2 Likes
I came here via google with the same issue.
These changes to the .gitignore file fixed the problem for me:
1 Like
Oh… checking if this fixes my horrible headache…
It does! Thank you very much indeed!
Worked for me too, thanks