59 lines
3.0 KiB
C#
59 lines
3.0 KiB
C#
// WL-816f — 채택값을 에셋에 굽는다(에디트 모드).
|
|
// ① 풀 머티리얼 복사본 `Farm_Grass_Demo.mat`(데모 `Instanced_Grass` 0줄 · 복사본만)
|
|
// ② SO: 풀 머티리얼 교체 · 밀도 2.5 → 1.8
|
|
public static class WL816f_Build
|
|
{
|
|
const string SoPath = "Assets/WL/Look/Farm/Resources/WL/WLIslandLookSettings.asset";
|
|
const string MatPath = "Assets/WL/Look/Farm/Materials/Farm_Grass_Demo.mat";
|
|
|
|
public static void Run()
|
|
{
|
|
var sb = new System.Text.StringBuilder();
|
|
var cfg = UnityEditor.AssetDatabase.LoadAssetAtPath<WL.Look.Farm.WLIslandLookSettings>(SoPath);
|
|
if (cfg == null) { UnityEngine.Debug.Log("SO 없음"); return; }
|
|
|
|
// ① 풀 머티리얼 복사본
|
|
UnityEngine.Material grassSrc = null;
|
|
for (int i = 0; i < cfg.scatter.Length; i++)
|
|
if (cfg.scatter[i] != null && cfg.scatter[i].label.Contains("풀")) grassSrc = cfg.scatter[i].material;
|
|
if (grassSrc == null) { UnityEngine.Debug.Log("풀 머티리얼 없음"); return; }
|
|
|
|
var mat = UnityEditor.AssetDatabase.LoadAssetAtPath<UnityEngine.Material>(MatPath);
|
|
if (mat == null)
|
|
{
|
|
mat = new UnityEngine.Material(grassSrc);
|
|
mat.name = "Farm_Grass_Demo";
|
|
UnityEditor.AssetDatabase.CreateAsset(mat, MatPath);
|
|
sb.AppendLine("새 머티리얼 " + MatPath + " (원본 " + grassSrc.name + " 복사)");
|
|
}
|
|
else sb.AppendLine("기존 머티리얼 갱신 " + MatPath);
|
|
|
|
// 816f 실측 채택값 — 풀 화면색 ≈ 바닥 화면색(데모와 같은 「안 튀는 풀」)
|
|
mat.SetColor("_DiffuseColor", Hex("#A6E39F"));
|
|
mat.SetColor("_ShadowDiffuseColor", Hex("#95CC8F"));
|
|
UnityEditor.EditorUtility.SetDirty(mat);
|
|
|
|
// ② SO
|
|
for (int i = 0; i < cfg.scatter.Length; i++)
|
|
{
|
|
var s = cfg.scatter[i];
|
|
if (s == null) continue;
|
|
if (s.label.Contains("풀")) { s.material = mat; s.density = 1.8f; sb.AppendLine("풀: mat→Farm_Grass_Demo · density 2.5→1.8"); }
|
|
else if (s.label.Contains("꽃")) { s.density = 1.8f; sb.AppendLine("꽃: density 2.5→1.8 (풀과 같은 층)"); }
|
|
}
|
|
UnityEditor.EditorUtility.SetDirty(cfg);
|
|
UnityEditor.AssetDatabase.SaveAssets();
|
|
UnityEditor.AssetDatabase.Refresh();
|
|
|
|
sb.AppendLine("soilToneEnabled=" + cfg.soilToneEnabled + " soilTint=" + cfg.soilTint + " soilCheckerContrast=" + cfg.soilCheckerContrast);
|
|
sb.AppendLine("islandTopMaterial=" + (cfg.islandTopMaterial ? cfg.islandTopMaterial.name : "없음")
|
|
+ " _BaseMap=" + (cfg.islandTopMaterial && cfg.islandTopMaterial.GetTexture("_BaseMap")
|
|
? cfg.islandTopMaterial.GetTexture("_BaseMap").name : "없음"));
|
|
System.IO.File.WriteAllText("AgentScripts/WL816f_BUILD.txt", sb.ToString());
|
|
UnityEngine.Debug.Log(sb.ToString());
|
|
}
|
|
|
|
static UnityEngine.Color Hex(string h)
|
|
{ UnityEngine.Color c; UnityEngine.ColorUtility.TryParseHtmlString(h, out c); return c; }
|
|
}
|