forked from MicroGSD/RoadArchitect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GSDRoadUtilityEditor.cs
35 lines (31 loc) · 953 Bytes
/
GSDRoadUtilityEditor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace GSD.Roads{
#if UNITY_EDITOR
public static class GSDRoadUtilityEditor{
public static void SetRoadMaterial(string tPath, MeshRenderer MR, string tPath2 = ""){
Material tMat2;
Material[] tMats;
Material tMat = (Material)AssetDatabase.LoadAssetAtPath(tPath, typeof(Material));
if(tPath2.Length > 0){
tMats = new Material[2];
tMats[0] = tMat;
tMat2 = (Material)AssetDatabase.LoadAssetAtPath(tPath2, typeof(Material));
tMats[1] = tMat2;
}else{
tMats = new Material[1];
tMats[0] = tMat;
}
MR.sharedMaterials = tMats;
}
public static Material GiveMaterial(string tPath){
return (Material)AssetDatabase.LoadAssetAtPath(tPath, typeof(Material));
}
public static PhysicMaterial GivePhysicsMaterial(string tPath){
return (PhysicMaterial)AssetDatabase.LoadAssetAtPath(tPath, typeof(PhysicMaterial));
}
}
#endif
}