Hi! I’m getting a weird error at line 88 with the SunShafts.cs script.
This ONLY happens when I add the component by code, if I attach it to an object in the editor and run it, it works just fine, this is how I’m adding it btw.
Now why I’m adding it by code and not as normal? because I have in-game settings, I tried destroying it instead of adding it but! I get another weird issue, even when the script doesn’t exist on scene, if it ran just 1 frame (enough time before I destroy it) then the game performance decreases, this is hard to explain, but I posted some weeks ago about that weird problem, so what could be going wrong here?
It’s in the base class. This script isn’t maintained by my team, but at a guess the sunShafts Shader is set as a default on the script (select the script and look in the inspector, there will be a set of ‘defaults’).
You might need to do some minor maintenence.
*Move the shader into a resources folder
*Make sunShaftsShader that does a Shader.Find for the shader
We do this in the new image effects, take a look there if you want to see how it’s done. Setting defaults like this in the inspector is nice, but it only works when you do things in the editor.
Would it be possible to make the CS version of unity 5 to work on unity4? I really need to setup the ray caster via script and I’m totally unable to do so. Even enable/dissable the shafts is a pain. I can only enable and for whatever reason it does not dissable…
I tested a cs version witch should have gone fine but id did not, it did not allow to enable. Found a CS version that prints shame issue as related in this post