I have started to use Git to manage my Unity project.
I added two folders to Git: “Assets” and “ProjectSettings”. rest of files and folder added to “.gitignore” and added “.gitignore” to git.
Every time I clone the repository, I need to add the scene to the project and delete default scene which was somehow added to the project instead of mine.
What do you mean “add the scene to the project”? The project is simply the folder and scenes are saved in the Assets directory. Do you mean added to the build settings?
Once you’ve made changes to the build settings, use File->Save Project. You should have changes to “ProjectSettings/EditorBuildSEttings.asset” which is the file that contains the editor build settings. Scenes used for the build are recorded there, but might not get saved until you save the project itself (which I believe also happens automatically when exiting Unity).
I did exactly as you said. I also saw that “ProjectSettings/EditorBuildSEttings.asset” is changed.
I commit and push to the repository. However, after pulling the code to clean location the project doesn’t contain my scene but default one.
One thing though, which i am not sure if it relates to my problem. When I open the cloned project using Unity first time after clone, it always Imports it before. Maybe the Import process replaces my scene?
Is it worth mentioned that I am using Unity for HoloLens?
I think the scenario OP is trying to ask is:
If a person who wants to try out the game cloned the source code, he wants the first scene to be already at the hierarchy window so that the person need to just click play and it will play the game.
I have exactly the same issue. I’m setting up project files for a new University course. Students are first timers in Unity and I want the project to open using the Scene that I created but an Untitled scene appears, not the one that I used when creating the project. Putting the scene in the Build settings doesn’t help.
Just to be clear, I am using the standard gitignore in Github Desktop, meaning GIT will not upload the Library folder (because of its size and the fact that it can be easily rebuilt). However, it may be too brutal.
For example, there is a file in Library called SceneVisibilityState.asset. However, it’s not text so I can’t decipher it. Is that relevant to this problem?
I still want to ignore the bulk of the Library folder when committing to Github, due to size. Also the Uni computers are initialised every night so students can’t just save projects there.
I’ll happily create a new gitignore file but I really need to know what are the critical files and whether uploading a partial library will cause a problem.
Last opened scene is not stored in project folders but in Editor itself via EditorPrefs. So it means it will save your last opened scene in your windows registry.
Thank you. I appreciate your help. All I can say is Yuk! Surely that ties the editor to many different projects. I would have thought that editor preferences and working methods might vary by project and so should be saved with the project data.
The file mentioned by NickAtUnity (ProjectSettings/EditorSettings.asset) doesn’t contain seem to contain any scene related info (It’s a yaml file so is readable).