Not able to store gameobjects under hierarchy in git repo

I have a unity project which has assets in the Hierarchy such as the player gameobject and UI related stuff.
But when I git commit everything, then clone and open the project in another machine, gameobjects are missing in the Hierarchy. Only the Main Camera remains.

Other things like prefab and scripts are there.
Bit worrying if there are other things missing in version control which are not obvious.
Why is this so?

I am using Rider IDE if that matters.
And the following is the content of my .gitignore file.
Is copied from here: gitignore/Unity.gitignore at main · github/gitignore · GitHub

    # This .gitignore file should be placed at the root of your Unity project directory
    #
    # Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
    #
    /[Ll]ibrary/
    /[Tt]emp/
    /[Oo]bj/
    /[Bb]uild/
    /[Bb]uilds/
    /[Ll]ogs/
    /[Uu]ser[Ss]ettings/
  
    # MemoryCaptures can get excessive in size.
    # They also could contain extremely sensitive data
    /[Mm]emoryCaptures/
  
    # Recordings can get excessive in size
    /[Rr]ecordings/
  
    # Uncomment this line if you wish to ignore the asset store tools plugin
    # /[Aa]ssets/AssetStoreTools*
  
    # Autogenerated Jetbrains Rider plugin
    /[Aa]ssets/Plugins/Editor/JetBrains*
  
    # Visual Studio cache directory
    .vs/
  
    # Gradle cache directory
    .gradle/
  
    # Autogenerated VS/MD/Consulo solution and project files
    ExportedObj/
    .consulo/
    *.csproj
    *.unityproj
    *.sln
    *.suo
    *.tmp
    *.user
    *.userprefs
    *.pidb
    *.booproj
    *.svd
    *.pdb
    *.mdb
    *.opendb
    *.VC.db
  
    # Unity3D generated meta files
    *.pidb.meta
    *.pdb.meta
    *.mdb.meta
  
    # Unity3D generated file on crash reports
    sysinfo.txt
  
    # Builds
    *.apk
    *.aab
    *.unitypackage
    *.app
  
    # Crashlytics generated file
    crashlytics-build.properties
  
    # Packed Addressables
    /[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
  
    # Temporary auto-generated Android Assets
    /[Aa]ssets/[Ss]treamingAssets/aa.meta
    /[Aa]ssets/[Ss]treamingAssets/aa/*

If I remove .gitignore altogether, the following are waiting to be added but should I?

    .idea/
    Assembly-CSharp.csproj
    Library/
    Logs/
    My project.sln
    Temp/
    UserSettings/

What I should see.

What I actually see when I clone and open project in another machine. (Confirm latest has been pushed and pulling from correct branch)

images are broken
gitignore seems fine

I’d make a diff of the two Assets directories (source & clone) to see what is or isn’t there, but BEFORE you open the cloned project in Unity Editor. If these are identical, you’ll know it’s something with the other folders, eg project settings or packages and such.

in your 2nd image, the scene is not opened yet. (it shows Untitled)
So check if your Main scene is there and open that.

1 Like

In case you openned project in other machine first time after first pull then odds are you just see the sample (default) scene, look in assets for the saved scene and open that one.
Other than that scenes are serialized in text (if you haven’t changed it) so you can check if it is saved in git repo properly.

7 Likes

Worked for me thanks

Please use the like button to show appreciation, don’t necro post.
Thread locked