Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
// 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
You can’t perform that action at this time.