Phantom
Phantom

Reputation: 11

Unity and Github Scene Merging

So my team has been running into a problem with GitHub and Unity. Whenever we try to merge branches our scene gets screwed up, everything in the scene gets deleted and overall it causes problems. Were trying to look for a better way to do this. Does anyone who has experience working in big teams know how to solve this? Like a workflow or process of moving work into the main branch that can solve this problem? Anything will help!

Upvotes: 1

Views: 1044

Answers (1)

Milan Egon Votrubec
Milan Egon Votrubec

Reputation: 4049

The way I've been able to successfully work with GitHub in a team is to make everything a prefab. To clarify, I looked at my hierarchy top level, and tried to make everything there a separate prefab. e.g.

root
.Camera Items
.Game Manager Items
.Level Game Objects

By separating areas of concern into separate prefabs, you can modify the prefab, which is saved as an asset, and the actual Scene itself isn't modified.

To break it down, if your scene is made up of the three items listed above, then it doesn't matter how much you modify your specific prefabs, the scene is STILL just made up of the three prefabs. The scene doesn't store the prefab details, just a reference to the prefab.

So, Person A can be working on the Game Manager prefab, and Person B can be working on the Level Game Objects prefab, and when it comes time to commit, the scene itself hasn't changed.

The one point is that the prefab overrides ARE saved in the scene, so, to make things easier, we simply made sure our prefabs were completely saved before committing.

It's not easy to get into the swing of it, but when you do, it's workable. Not great, but workable.

Upvotes: 3

Related Questions