unity 3D 在安卓环境下使用assetbundle打包Image中shader丢失问题

最近经常做一些2D项目,因为画面很重要,所以加了很多特效。有时候我们已经把所需要的shader添加至editor-project setting -graphics-always included shaders ,用assetbundle打包之后还是会丢失。今天找到处理方法。

public class LoadShader : MonoBehaviour {
    private Shader _shader;
    private Image _image;
    private Material _material;
 
    // Use this for initialization
    void Start () {
        _image = GetComponent();
        _material = _image.material;
        _shader = Resources.Load("saoguang");
        _material.shader = _shader;
    }
    
    // Update is called once per frame
    void Update () {
        
    }
}
使用此方法必须将shader放入resource文件夹中

你可能感兴趣的:(其它,unity3d,shader,assetbundle)