This is my first time building with WebGL and I don’t know why this issue is happening. When I build my game for Windows, all the materials load correctly. However, when I build it with WebGL the shaders break.
I’ve placed the shaders in the Graphics section of Project Settings, and I’ve tried to load them with Resources.Load but I’m not sure I’ve done it correctly.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FindShader : MonoBehaviour
{
protected void Start()
{
Material mat = GetComponent<SpriteRenderer>().material;
mat.shader = Shader.Find(mat.shader.name);
}
}