//Init stuff. void Start() { //Setting instance and ditionary, if not already done. if (renderers == null) { renderers = new Dictionary <int, OutlineGlowRenderer>(); } if (instance == null) { instance = this; } if (!SystemInfo.supportsImageEffects || !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth)) { this.enabled = false; return; } else { if (this.DepthTest) { this.GetComponent <Camera>().depthTextureMode |= DepthTextureMode.DepthNormals; } } }
//Init stuff. void Awake() { //Setting instance and ditionary, if not already done. if (renderers == null) { renderers = new Dictionary <int, OutlineGlowRenderer>(); } if (instance == null) { instance = this; } if (!SystemInfo.supportsImageEffects || !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth)) { this.enabled = false; return; } if (SecondPassShader == null) { SecondPassShader = Shader.Find("Hidden/WhiteDraw"); } if (BlurPassShader == null) { BlurPassShader = Shader.Find("Hidden/OutlineBlur"); } if (MixPassShader == null) { MixPassShader = Shader.Find("Hidden/OutlineMix"); } }
// Update is called once per frame void Update() { //Grabbing id here, as it doesn't work in Start without modifying the script execution order. Shouldn't cost too much performance. if (myID == -1) { OutlineGlowEffectScript es = OutlineGlowEffectScript.Instance; if (es != null) { myID = es.AddRenderer(this); } } }