Hi,
I am learning to use the AssetPostprocessor to import assets automatically with specific settings.
So far I am just testing, so I import a model and its textures by selecting the textures folder and the FBX model, then drag and drop onto the “Assets/Models” folder in Unity, I am dragging and dropping the FBX with textures folder because this way the engine automatically assigns the materials and textures.
However the textures folder is imported in the “Models” folder, I would like to change the textures path from “Assets/Models/” to “Assets/Materials/”
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class NewBehaviourScript : AssetPostprocessor
{
void OnPreprocessAsset()
{
if (assetImporter.assetPath.EndsWith(".psd"))
{
AssetDatabase.ImportAsset(assetImporter.assetPath.Replace("/Models/", "/Materials/"));
}
}
}
I have tried this but no luck.
Any help welcome, thanks.