I'm trying to animate the skybox blend values but no luck so far, i'm having trouble trying to correctly access the shaders properties which in my case is _Blend but not sure if im using it correctly? Code (CSharp): using UnityEngine; public class Blendskybox : MonoBehaviour { Renderer blend; // Start is called before the first frame update void Start() { blend = GetComponent<Renderer>().material.SetFloat("_Blend", 1.0f); blend.material.shader = Shader.Find("Blend"); } // Update is called once per frame void Update() { float blend = Mathf.PingPong(Time.time, 1.0f); blend.material.SetFloat("_Blend", blending); } }
Line 9 obviously does not compile, as the .SetFloat() method returns a void. Break that line up as it is clearly a "hairy line of code" even if it did compile. How to break down hairy lines of code: http://plbm.com/?p=248 One. Thing. Per. Line. Please. Also, generally do NOT use Shader.Find() because it is fragile and subject to silent asset stripping. Instead, make an instance of the material you want and drag it into a public Material field.