private static void Prefix() { Logger.Debug("== List of Material that can be used for Materials Parameters =="); //TODO: Replace this to AssetShardManager Code var fullmats = Resources.FindObjectsOfTypeAll(Il2CppType.Of <Material>()); foreach (var obj in fullmats) { var mat = obj.Cast <Material>(); var matName = mat?.name ?? string.Empty; var shaderName = mat?.shader?.name ?? string.Empty; if (string.IsNullOrEmpty(matName)) { continue; } if (!ConfigManager.Current.ModelCustom.CacheAllMaterials) { if (!shaderName.Contains("EnemyFlesh")) { continue; } } MaterialCustom.AddToCache(matName, mat); Logger.Debug(matName); } Logger.Debug("== End of List =="); }
public static MeshDrawer CreateBox(Vector3 size) { var mesh = CreateBoxMesh(size / 2); ShaderSettings ss = new ShaderSettings(); RenderDirectives rd = new RenderDirectives(); string path = "Toys.Resourses.shaders."; string vs = ShaderManager.ReadFromAssetStream(path + "UIElement.vsh"); string fs = ShaderManager.ReadFromAssetStream(path + "UIElement.fsh"); ss.TextureDiffuse = true; var material = new MaterialCustom(ss, rd, vs, fs); material.Name = "Texture"; material.SetTexture(Texture2D.LoadEmpty(), TextureType.Diffuse); return(new MeshDrawer(mesh)); }