Somian
September 28, 2019, 6:05pm
1
Hi,
is it possible to prevent Unity from importing files?
Ideally, some kind of gitignore-style file, but for the Unity editor itself.
The reason I’m asking is that, when I work with 3D packages on something directly in the /Assets folder, they often create autosave files which Unity will import.
Thanks!
You should be able to at least deactivate some option of the importation but every file under the project Assets folder is imported:
using UnityEngine;
using UnityEditor;
public class IgnoreAutoSaves : AssetPostprocessor
{
void OnPreprocessModel()
{
if (assetPath.Contains("autosave")) //or whatever you can use to recognize autosaves
{
ModelImporter modelImporter = assetImporter as ModelImporter;
modelImporter.importAnimatedCustomProperties = false;
modelImporter.importAnimation = false;
modelImporter.importBlendShapeNormals = false;
modelImporter.importBlendShapes = false;
modelImporter.importCameras = false;
modelImporter.importConstraints = false;
modelImporter.importLights = false;
modelImporter.importNormals = false;
modelImporter.importTangents = false;
modelImporter.importVisibility = false;
}
}
}
But I think you should see if the software you use allows you to change the folder where auto saving files are written