- Home /
Github not working with unity
Hey all, I've been trying to make github work with unity and but it's not and I can't seem to find answers anywhere, so I've come to you all for help. Here's the problem:
I've set up a sample 2d scene in unity with a background sprite, a player sprite and a character controller script. It's all set up properly in the scene view and works as intended. Now when I commit these changes and push to origin with the git desktop client, and the person I'm collaborating with receives it, they receive the assets (both sprites and the character controller script) but the scene is empty and there are no objects in the hierarchy. We think it has something to do with the gitignore file ignoring more than it should but we're not sure. We're using the basic Unity gitignore that gitub provides on creating a new repository.
Here's the link to the gitignore being used: https://github.com/github/gitignore/blob/master/Unity.gitignore
Any ideas what could be going wrong?
Note: My teammate also sent me a sample project on unity and it worked as intended on my pc. The only difference between our projects was that her gitignore wasn't placed in the root directory and thus wasn't ignoring anything. This reinforces my theory about the gitignore not working properly.
Can you link the gitignore you use? Also can you specify what you mean by root folder?
Gitignore link now added. By the root folder, I mean the folder where unity stores all the data (Library, Assets, etc.)
Are you sure the Version Control mode
is set to Visible $$anonymous$$eta Files
& Asset Serialization
is set to Force Text
in the Editor
section of the Project settings?
Can you provide the path of the scene in your project assets as long as a link to the gitignore?
Yes, Version Control is set to Visible $$anonymous$$eta Files, and Asset Serialization is set to Force Text. Could you specify what you want me to send in regards to the path of the scene?
Could you specify what you want me to send in regards to the path of the scene?
I want to know where is located the scene in your assets folder. Something like Assets/Scene/$$anonymous$$yScene.unity
Also, make sure your scene is actually visible on your Git host.
If you have it on Github, make sure you can find the scene in the files and make sure this file has some content.
It is, and the scene folder has both the scene file and the scene meta file
And you are sure your friend checked out the correct commit on the correct branch?
Answer by SquirrelGD · Aug 26, 2020 at 08:08 AM
Update: I'm so sorry for wasting your time guys, it was a stupid mistake. Unity was not automatically loading the scene I had worked on so she had to manually load it. It was so unexpected that we didn't even think to look there. Thank you all for your prompt responses and patience.
Answer by sacredgeometry · Aug 25, 2020 at 09:25 PM
There are plenty of guides on how to get unity to work with git:
The main two problems are serialisation of projects and large file storage for assets. Either way both are explained in the links below.
https://medium.com/@j0hnm4r5/git-with-unity-92ca7854ea3d https://thoughtbot.com/blog/how-to-git-with-unity
Your answer
![](https://koobas.hobune.stream/wayback/20220613010513im_/https://answers.unity.com/themes/thub/images/avi.jpg)