Created
January 15, 2019 13:44
-
-
Save ronyx69/14655bc04d94fc6557dfc79739cef832 to your computer and use it in GitHub Desktop.
Converts a texture to a different format for dumping with mod tools, for cases where some textures can't be dumped normally. Puts the converted texture in Sunny Properties > Sunny Net > NetProperties >m_downwardDiffuse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// map theme texture | |
var source = UnityEngine.Object.FindObjectOfType<TerrainProperties>().m_grassDiffuse; | |
var target = new Texture2D(source.width, source.height, TextureFormat.RGBAFloat, true); | |
target.SetPixels(source.GetPixels()); | |
target.anisoLevel = source.anisoLevel; target.filterMode = source.filterMode; | |
target.wrapMode = source.wrapMode; target.Apply(); | |
UnityEngine.Object.FindObjectOfType<NetProperties>().m_downwardDiffuse = target; | |
// network node | |
var networkName = "1307021974.UK Roads: Plain 2-Lane 2 Way DYL_Data"; | |
var material = PrefabCollection<NetInfo>.FindLoaded(networkName).m_nodes[0].m_nodeMaterial; | |
var source = material.GetTexture("_MainTex") as Texture2D; | |
var target = new Texture2D(source.width, source.height, TextureFormat.RGBAFloat, true); | |
target.SetPixels(source.GetPixels()); | |
target.anisoLevel = source.anisoLevel; target.filterMode = source.filterMode; | |
target.wrapMode = source.wrapMode; target.Apply(); | |
UnityEngine.Object.FindObjectOfType<NetProperties>().m_downwardDiffuse = target; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment