the project I’ve tested it works in Editor or Mobile Devices when the ComputeShader doesn’t in AssetBundle.
Attach a script using this ComputeShader in a scene or loading by Resources.Load is perfectly worked. but when I build AssetBundle. it doesn’t work anymore.
I’ve tested in these situations in unity 2019.4.16f1 and unity 2020.3.11f1
Situation 1: Assetbundle file with a scene and this ComputeShader.
Situation 2: Assetbundle file with a scene and another assetbundle file with this ComputeShader.
both situation doesn’t work correctly.
when I call ComputeShader.FindKernel, it always throws ArgumentException: Kernel ‘CSMain’ not found.
code below:
string csf = Path.Combine(Application.streamingAssetsPath, "computeshader.ab");
AssetBundle ab = AssetBundle.LoadFromFile(csf);
ComputeShader _ComputeShader = ab.LoadAsset<ComputeShader>("computeshader.compute");
ComputeShader _Instance_ComputeShader = Instantiate(_ComputeShader);
int Kernel = _Instance_ComputeShader.FindKernel("CSMain"); //throws the exception in this line.