Editor Version 2022.3.45f1
I got the following error when I opened a Unity project cloned from GitHub.
fbx,mp3 files are not imported properly and are missing.
ImportFBX Errors:
Couldn't read file
None of the registered readers can process the file
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Errors during import of AudioClip
FSBTool ERROR: The format of the source file is invalid, see output for details.
FSBTool ERROR: Internal error from FMOD sub-system.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
I have already tried.
・Reboot PC
・Reimport individual files
・Clone the repository again.
・Delete Library folder of Unity project and restart.
・Reinstall GitLFS.
・Delete C:\Users<username>\AppData\Local\Unity\Editor\Editor.log and restart.
・Check if the dependencies in Packages/manifest.json are written.
Other team members’ PCs do not have this error
Maybe it’s my PC that’s causing it.
Please Help me !!!
Compare one or more of the affected files’ hash with the one in the repository to see if they match. If they differ they’ll come up as changed files, check the git GUI or command line for changes. If they differ, you got corrupted files.
If no changes are listed, try creating a new empty project and drop in one or more of the affected files. If this works, the issue is with just the project but not the files themselves nor your system.
If the files do not import in a new project, zip and send them to a team member. They should drop it into a project to see if the same issue occurs for them. If the files work for them, the problem is definitely with your system.
Make sure to prevent antivirus from scanning Unity project folders.
Thank you for your response!
I opened the file that causes the import error in a newly created project and it was fine!
I set up folder exclusions in my Windows security software and cloned the file, but this does not work either!
I really don’t know what is causing this…,
Check if the project where it doesn’t work has any importer overrides. You can do this with AssetDatabase.GetImporterOverride. If it returns non-null, find the script by its type and check if this somehow throws these errors.
Other than a different importer being used I can’t explain why the same asset would fail to import in one project but be okay in a new project.
Also, if you have many of these errors when opening the project, be sure to look at those errors from top to bottom. First error is always most important. The import errors may merely be a symptom (follow-up errors) of a script throwing an exception.
Sorry for the late reply.
I used AssetDatabase.GetImporterOverride and GetDefaultImporter as advised!
The result is that when I use GetImporterOverride, I am told that the importer is not found!
When I used GetDefaultImporter, I was able to get an importer for the asset type.
fbx : ModelImporter
mp3:AudioImporter
texture: TextureImporter
Here is the actual code I used
The file paths are temporary.
using UnityEditor;
using UnityEngine;
public class ImporterExample
{
[MenuItem("Tools/GetDefaultImporter")]
public static void GetDefaultImporter()
{
string assetPath = "Assets/YourAssetPath/YourAsset.fbx";
var importer = AssetDatabase.GetDefaultImporter(assetPath);
if (importer != null)
{
Debug.Log($"Importer for {assetPath}: {importer.Name}");
}
else
{
Debug.LogError($"No importer override found for {assetPath}");
}
}
[MenuItem("Tools/GetImporterOverride")]
public static void GetImporterOverride()
{
string assetPath = "Assets/YourAssetPath/YourAsset.fbx";
var importer = AssetDatabase.GetImporterOverride(assetPath);
if (importer != null)
{
Debug.Log($"Importer for {assetPath}: {importer.Name}");
}
else
{
Debug.LogError($"No importer override found for {assetPath}");
}
}
}
Okay this sounds about right. Meaning its using the default importers. Since the files can open in an empty project it can’t be some missing OS component either. I’m stumped.
Unless … what’s the path to that project? Path lengths on windows are restricted to 260 or even 240 characters, somewhere in that range. If you have that project a few folders deep in Documents and the project itself has many subfolders, it is entirely possible that some asset paths became too long resulting in such ominous errors.
Try pulling the project to a folder on the drive root ie D:/TheProject
Then again, placing a project on C: root could cause the folder/files to have incorrect permissions, particularly if the folder was created with an admin account. Check file/folder permissions, the “common users” should have RWX if not full permissions.
The project folder is located on drive D.
The file path is about 160 characters long, so there is no problem.
I have not used any double-byte characters or invalid characters.
Below is the path to the image file for the import error. D:\UnityProjects\WaterworksBureau\WaterworksBureau_Unity\Library\PackageCache\com.company.medicalassets@2748c5f179\1_3DUIButtons \Key\geometry_combined.png
I tried cloning directly under drive D, but this also gave me an import error
What if you take this png that won’t import and drag & drop it onto the root /Assets folder in the editor? If this imports its apparently an issue with the file location or package.
Do all the errors come from the same package com.imacreate.medicalassets? If so perhaps that package is the issue. Packages aren’t necessarily all in the git repository, if you use a custom registry the package may be corrupted in your local PackageCache under AppData. Deleting that folder (with project closed) can fix some package issues.
I think I edited the spaces in the file path incorrectly.
The correct path does not contain spaces.
I have already tried those methods, but they did not solve the problem.
I contacted Unity support and they said it was a GitLFS issue and would not help me further.
I have reinstalled GitLFS but it has not resolved the issue.
I don’t get any errors when I clone, so it’s really a mystery.
If you leave the audio files in the project as-is, but then open them in a separate application without moving them (e.g. Windows Media Player or Quicktime), do they work?
That would at least confirm that they’ve been properly checked out by LFS. It’s certainly…unexpected that they would work in one project and not the other given your other team-mates don’t have the problem…