Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void OnAssignMaterialModel(Material material, Renderer renderer)
- {
- string materialPathnew = "Assets/ArtAssets/Materials/walls/";
- int fileNameIndex = assetPath.LastIndexOf('/');
- string fileName = assetPath.Substring(fileNameIndex + 1);
- fileName = fileName.Substring(0, fileName.Length - 4) + "_mat.mat";
- materialPathnew = materialPathnew + fileName;
- Debug.Log(materialPathnew);
- string[] split = assetPath.Split('/');
- string newAssetPath = "";
- for (int i = 0; i < split.Length - 1; i++)
- {
- newAssetPath += split[i] + "/";
- }
- newAssetPath = (newAssetPath + "Materials/") + fileName ;
- // Debug.Log(newAssetPath);
- var assetType = AssetDatabase.GetMainAssetTypeAtPath(newAssetPath);
- Debug.Log(newAssetPath);
- Debug.Log(assetType);
- AssetDatabase.MoveAsset(newAssetPath, materialPathnew);
- AssetDatabase.SaveAssets();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement