I'm having the same trouble. I'm trying to replace snow/ice textures.
The ice texture replaced fine. Its path is: Textures\Terrain\Surfaces\Ice.png
But the snow refuses to work. Its paths are: Textures\Terrain\Other\Snow.png and Textures\Weather\Overlays\SnowWorldOverlay.png
The filenames are correct and the paths, according to the art source, should also be correct.
Hmm. Had a closer look in the code and the actual path seems to be Materials\Misc\Snow and Materials\Weather... I think? But that's materials, right? Not textures? I couldn't find any mention of where "MatLoader" gets its texture paths from.
"MatBases" is the only place in the whole code where the word Snow even appears. I think it's forced to load from the resources.assets archive and not able to be modded without entirely changing how the whole darn thing works. But I don't know. I'm firing into the dark with all this.
Any clues?
using System;
using UnityEngine;
namespace Verse
{
// Token: 0x02000451 RID: 1105
[StaticConstructorOnStartup]
public static class MatBases
{
// Token: 0x040013FF RID: 5119
public static readonly Material LightOverlay = MatLoader.LoadMat("Lighting/LightOverlay", -1);
// Token: 0x04001400 RID: 5120
public static readonly Material SunShadow = MatLoader.LoadMat("Lighting/SunShadow", -1);
// Token: 0x04001401 RID: 5121
public static readonly Material SunShadowFade = MatBases.SunShadow;
// Token: 0x04001402 RID: 5122
public static readonly Material EdgeShadow = MatLoader.LoadMat("Lighting/EdgeShadow", -1);
// Token: 0x04001403 RID: 5123
public static readonly Material IndoorMask = MatLoader.LoadMat("Misc/IndoorMask", -1);
// Token: 0x04001404 RID: 5124
public static readonly Material FogOfWar = MatLoader.LoadMat("Misc/FogOfWar", -1);
// Token: 0x04001405 RID: 5125
public static readonly Material Snow = MatLoader.LoadMat("Misc/Snow", -1);
}
}
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Verse
{
// Token: 0x02000453 RID: 1107
public static class MatLoader
{
// Token: 0x060020C2 RID: 8386 RVA: 0x000C86D8 File Offset: 0x000C68D8
public static Material LoadMat(string matPath, int renderQueue = -1)
{
Material material = (Material)Resources.Load("Materials/" + matPath, typeof(Material));
if (material == null)
{
Log.Warning("Could not load material " + matPath, false);
}
MatLoader.Request key = new MatLoader.Request
{
path = matPath,
renderQueue = renderQueue
};
Material material2;
if (!MatLoader.dict.TryGetValue(key, out material2))
{
material2 = MaterialAllocator.Create(material);
if (renderQueue != -1)
{
material2.renderQueue = renderQueue;
}
MatLoader.dict.Add(key, material2);
}
return material2;
}
// Token: 0x04001406 RID: 5126
private static Dictionary<MatLoader.Request, Material> dict = new Dictionary<MatLoader.Request, Material>();
// Token: 0x0200161C RID: 5660
private struct Request
{
// Token: 0x06008192 RID: 33170 RVA: 0x0029BF63 File Offset: 0x0029A163
public override int GetHashCode()
{
return Gen.HashCombineInt(Gen.HashCombine<string>(0, this.path), this.renderQueue);
}
// Token: 0x06008193 RID: 33171 RVA: 0x0029BF7C File Offset: 0x0029A17C
public override bool Equals(object obj)
{
return obj is MatLoader.Request && this.Equals((MatLoader.Request)obj);
}
// Token: 0x06008194 RID: 33172 RVA: 0x0029BF94 File Offset: 0x0029A194
public bool Equals(MatLoader.Request other)
{
return other.path == this.path && other.renderQueue == this.renderQueue;
}
// Token: 0x06008195 RID: 33173 RVA: 0x0029BFB9 File Offset: 0x0029A1B9
public static bool operator ==(MatLoader.Request lhs, MatLoader.Request rhs)
{
return lhs.Equals(rhs);
}
// Token: 0x06008196 RID: 33174 RVA: 0x0029BFC3 File Offset: 0x0029A1C3
public static bool operator !=(MatLoader.Request lhs, MatLoader.Request rhs)
{
return !(lhs == rhs);
}
// Token: 0x06008197 RID: 33175 RVA: 0x0029BFCF File Offset: 0x0029A1CF
public override string ToString()
{
return string.Concat(new object[]
{
"MatLoader.Request(",
this.path,
", ",
this.renderQueue,
")"
});
}
// Token: 0x04005488 RID: 21640
public string path;
// Token: 0x04005489 RID: 21641
public int renderQueue;
}
}
}