mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Maybe fix base game shaders
This commit is contained in:
parent
bf88a362c6
commit
d1c6cb9efd
@ -23,6 +23,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
if (detail.assetBundle != null)
|
if (detail.assetBundle != null)
|
||||||
{
|
{
|
||||||
var prefab = PropBuildManager.LoadPrefab(detail.assetBundle, detail.path, uniqueModName, mod);
|
var prefab = PropBuildManager.LoadPrefab(detail.assetBundle, detail.path, uniqueModName, mod);
|
||||||
|
|
||||||
detailGO = MakeDetail(go, sector, prefab, detail.position, detail.rotation, detail.scale, detail.alignToNormal);
|
detailGO = MakeDetail(go, sector, prefab, detail.position, detail.rotation, detail.scale, detail.alignToNormal);
|
||||||
}
|
}
|
||||||
else if (detail.objFilePath != null)
|
else if (detail.objFilePath != null)
|
||||||
@ -30,6 +31,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var prefab = mod.ModHelper.Assets.Get3DObject(detail.objFilePath, detail.mtlFilePath);
|
var prefab = mod.ModHelper.Assets.Get3DObject(detail.objFilePath, detail.mtlFilePath);
|
||||||
|
PropBuildManager.ReplaceShaders(prefab);
|
||||||
prefab.SetActive(false);
|
prefab.SetActive(false);
|
||||||
detailGO = MakeDetail(go, sector, prefab, detail.position, detail.rotation, detail.scale, detail.alignToNormal);
|
detailGO = MakeDetail(go, sector, prefab, detail.position, detail.rotation, detail.scale, detail.alignToNormal);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -104,7 +104,25 @@ namespace NewHorizons.Builder.Props
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReplaceShaders(prefab);
|
||||||
|
|
||||||
return prefab;
|
return prefab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ReplaceShaders(GameObject prefab)
|
||||||
|
{
|
||||||
|
foreach (var renderer in prefab.GetComponentsInChildren<Renderer>(true))
|
||||||
|
{
|
||||||
|
foreach (var material in renderer.sharedMaterials)
|
||||||
|
{
|
||||||
|
if (material == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
material.shader = Shader.Find(material.shader.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user