Just upgraded the project from 2020.3.12 to 2021.2.b1 and got missing references in the nested prefab in an object in the scene.
Itās getting even worse. Now also localization string references are affected. This is really, really annoying. My work-around so far is to purge Unityās cache folders (like Library
) before doing a production build. This typically restores all broken links. But dare you if you forget to do it. It might render your complete app unusable.
We managed to overcome this issue in builds.
In our build pipeline we call method to reimport all prefabs (at earliest stage).
public static void ReimportAssets(string searchFilter)
{
var timeBeforeSearching = DateTime.Now;
// Finding assets
var objectGuids = AssetDatabase.FindAssets(searchFilter);
var objects = new Object[objectGuids.Length];
for (var i = 0; i < objectGuids.Length; i++)
{
var objectGuid = objectGuids[i];
var objectPath = AssetDatabase.GUIDToAssetPath(objectGuid);
var loadedObject = AssetDatabase.LoadAssetAtPath<Object>(objectPath);
objects[i] = loadedObject;
}
// Selecting assets and executing Reimport
Selection.objects = objects;
EditorApplication.ExecuteMenuItem("Assets/Reimport");
Debug.Log($"[{searchFilter}] Assets were imported. [{(DateTime.Now - timeBeforeSearching).Duration()}]");
}
ReimportAssets("t:Prefab");
And this code (if you call it before build, (in our case it is called automatically)) solves missing reference problem in builds.
Clearing Library folder is also valid solution (but it takes much longer time).
Hello everyone,
I have the same Issue on a cloned project with unity 2021.2.7f1 with following setup: I developed on PC, got a error free compile state, uploaded the project to Azure DevOps, then cloned the project on a Mac in terminal via git clone and after opening the project in unity all sprite references are missing. I really have no idea whats going on. I use the following git ignore file
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/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/
# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta
# 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/
.vsconfig
# 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
# 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/*
######################################################
# macOS specific ignores
######################################################
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
######################################################
# Windows specific ignores
######################################################
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
Anyone has a suggestion what I could do to get rid of this issue?
Greetings David
My problem was that LFS was missing from Git on the Mac laptop. After LFS was installed and activated the project was cloned correctly and the references were set. So this helped me:
-
Install homebrew from here https://brew.sh/index_de
-
Install git-lfs with homebrew
brew update
brew install git-lfs
- use git-lfs before clone
git lfs install
git clone <clonepath>
I discovered a issue similar to this, but happen for a different reason: I started a thread here:
After moving the files to another path, the references were lost and there was a warning āFix compile errorsā.
I solved the errors, the project recompiled and the references were recovered.
Still happening in 2022.2.x
Still happening in 2022.3.10f1.
Mine always losing references (kind of random) after I edited a script (loading)
Sam in 2021.3 LTS
I just did a clean checkout of a project using NWH vehicle physics in Unity 6000.0.26f1 and there were 4 missing references that didnāt get pushed to the repository by one team member. We all have that package licensed and itās included in the repo.
The rest of us had compilation errors when opening the project after checking it out for the first time. It is unclear why these were excluded from the developerās check-in. Any insight to how we can permanently resolve this would be much appreciated.
Iāve given up on UVCS and migrated the whole repo to straight up Git under Azure Devops. We are managing versions and conflict resolution using Visual Studio. Wow! All of our trust issues over what didnāt get pushed, but should have and what didnāt get pulled but should have are gone! Over half of all our problems using this platform vanished overnight!