Blaster Boring - Missing Prefabs

I tried pulling my project from the GitHub repo I was saving it to in order to work on it on a separate device.

When I did though, multiple assets were listed as “missing prefabs” with GUIDs. What I imagine this result is is from not “Prefabing” my entire levels and their assets so that they could be read when importing the project to new devices.

Debating on whether I should wait until I return to the device I was working on with the levels/assets built and positioned already, prefab all of them somehow, and then try to sync the project to the other machine or continue and try to manually recreate the level I made before…

1 Like


Have you already tried to restart Unity? Did you save the downloaded project on your normal internal harddrive?

I assume your original project is on your other device from which you pushed this project state. Given the project is not broken there, something probably went wrong with the commit(s). Maybe, and this is just a guess, the scene was not saved properly when you created and pushed the commit.

What you could do on this device now is to check the .gitignore file. Is there anything missing? Or are there additional files or filename endings listed? Compare your .gitignore to this one.

If you don’t have access to your device with the original project for a few days but would like to keep working on your project, work with this broken project but do not invest any time into making this game look good. Remove the red items from the Hierarchy and drag and drop your prefabs into the scene again.

Focus mainly on the scripts. Unlike Unity files, scripts are easy to check in the repository because they are just the text you wrote and know not thousands of lines of code with cryptic numbers. When you are done, save the .cs files on an USB stick (or whatever you prefer) to move them to the device with the original project. You can simply copy and those .cs files into your Assets folder.

Whatever you do, do not push this broken project state to your repository. Check your project on your other device first and try to make another commit.

Also make a backup of your project folder by duplicating it. Save the duplicated folder somewhere else, maybe on an USB stick. To save some free space, you could delete the Library and Temp folders in the backup folder. If something goes wrong with git, you will not lose your entire work.

I hope this helped. :slight_smile:

See also:

1 Like

Hi Nina!

I appreciate your response. After attempting some solutions and seeing how some of the missing assets were throwing errors I think I understand the problem.

I failed to commit updates to the prefab with the Overrides and I didn’t save all of the modified Level assets as their own prefabs (I changed their materials, positions, scales and rotations).

So I’m going to wait until I can access the project from the original device again, commit the overrides to the prefabs that need them committed, prefab the assets used to build each level into their own folders and then push it to my repository.

Hopefully with those changes, saved files and committing them everything will have the proper references and become synchronized.

Makes me wonder if prefabing everything is a good idea for future projects or whether to keep them as they are if I plan to work on the same project on two separate devices.

1 Like

In my personal opinion, prefabs should be created only for game objects that you want to use multiple times either when working on your scenes in the Unity or to spawn game objects at runtime. Typical prefabs are, for example, the player and enemies.

It is unlikely that you want to copy and paste an entire scene and use it as it is. For this reason, it does not make much sense to prefab it. In fact, if you have too many prefabs in your Assets folder, your Assets folder structure could become bloated. And if you start to tidy it up by deleting prefabs, you could unintentionally break your scenes. Or you could change something in scene 1, apply the changes, and suddenly there are undesired changes in other scenes as well.

In the end, there is no rule, though. Use the prefabs as they make sense to you and as they help you develop your game faster. They are not supposed to make your life harder.

If your idea was to make using your game on other computers easier, copy and paste the entire project folder instead and delete the Temp and Library folders. You can open the project as it is on other devices. If you want to work on the same project on different devices, it is more convenient to use a version control system such as git.

Copying and pasting single Unity files such as scenes is not recommended because you never know if there are any dependencies. In that case, you would rather create a package instead of a prefab. For “simple” files such as sprites, sounds and class files copying and pasting is fine.

1 Like

Right. I reworked the prefabs on where my project was originally stored and unpacked any asset that wasn’t essential to have prefab’d. I’ve also discarded the changes on my other device and pulled from my repository to try continuing my work.

I’m hitting the same Error I was before. Not with the Environment Assets any more but with my Landing/Launch Pad, Rocket, Ground, and Main Camera (I prefab’d it like the course advised to make the settings persist for new levels I created).

I’m still encountering the Missing Prefab error and noticed my prefabs are missing their scripts, materials and particle effects. My suspicion is that you were right and somewhere in my .gitignore the .meta files for those prefabs are being lost somewhere between committing to my repository and trying to pull/launch the project on my machine.

I’ll use tomorrow morning to cross-reference the .gitignore you sent me and the one I’ve been using. What place should the .gitignore be in so that doesn’t become a variable in this attempt at fixing this?

1 Like

Given your original project on your other computer still works fine, do the following:

  • Create a new folder somewhere else on your harddrive.
  • Create a new git repo for it.
  • Connect this new repo with your remote repo and pull the commits.
  • Open this “test” project in Unity.

Does this pulled project work on your computer? If so, you can assume that the repository is fine. In that case, the problem is on the computer where the project is broken.

If the pulled project does not work on your “original” computer either, there is indeed a problem with your remote repo.

The problem with git/.gitignore is that it does not add the missing files if your repo ignored them earlier. See here.

Before messing around with your git repo, definitely do make a backup of your entire project folder on your other computer including the .git folder where the project works fine. If the .git folder is not inside your project folder, make a backup of the folder that does contain the .git folder. This way, you will also have a backup of your git history. If you accidentally destroy it, you can easily retrieve it by creating a new remote repo and push the backup to that repo.

If you cannot spot any issue in your own .gitignore, don’t replace it. There is a chance that the problem is somewhere else. Some students save their projects on their Desktop, which is a folder managed by Windows, and Windows does not always allow you to do there everything you want. It might be that the operating system deletes certain Unity files. Also do not save your project on an USB stick or in a cloud but in a normal folder on your normal internal harddrive. Make sure that no antivirus and/or firewall restricts Unity’s access rights for your project folder.

If nothing helped, duplicate your working project including the .git folder on your other computer. (If it’s broken there as well, the problem was not caused by git or your repo. In that case, the following will not help either.) Delete the .git folder inside the duplicated project folder. Then create a new git repo for this project. The initial commit is supposed to contain nothing but the linked .gitignore. The next commit should contain your entire duplicated project (minus the files that are ignored due to .gitignore). Create a new remote repo and push the duplicated project to it.

On your other computer, pull the duplicated project and test it. If it is broken as well, I’m afraid that there is a bigger issue either on your “original” computer or on the “broken” one. Typical problems are antivirus softwares such as Avast and others. They often restrict access or even delete files that are still needed.

If git does not work properly for whatever reason, a workaround that allows you to work on different computers would be to copy and paste your project onto an USB-stick whenever you are done working on it on one computer. Do not work on the USB-stick. On another device, you copy and paste the project from your USB-stick.

Ideally, you should not override your existing project but create a new folder for the pasted project. Otherwise, it might be that you override “good” files with broken files from the USB-stick. This way, you will always keep at least one backup and don’t have to rely on the USB-stick, which might contain broken files.

1 Like

I looked at the .gitignore, read the StackOverflow thread, and backed up my project before anything else like you advised.

As suspected, my previous .gitignore file’s statements were preventing the .meta files associated with my assets from backing up. So the missing objects didn’t have the metadata to recreate themselves with when being pulled to my other machine from the repo.

This makes sense to me and explains why the project on my original machine I was building it on worked without error at any point and why pulling to my other machine made these errors occur.

I will confirm if changing the .gitignore to the standard Unity .gitignore was indeed the correct solution to this problem this afternoon and message back ASAP.

1 Like

Success! Looks like that was the problem all along!

I’ll be sure to remember this from now on as I keep working. I’ll stick to the Unity .gitignore file when working on game projects.

1 Like

Great work solving your problem!

1 Like

Fantastic! I’m glad your project is working now! :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms