unity3d - How to enable/disable cameras' effects programmatically? -
i have main camera in scene sun shafts (script) imageeffect on it.
[![enter image description here][1]][1]
(i'm using medieval environment asset.)
i'd disable effect programmatically when main camera reaches specific coordinate.
please kkep in mind, script i'd disable .js script.
so here code:
foreach(camera c in gameobject.findobjectsoftype(typeof(camera))) { if ((c.name == "main camera")) { if ((c.transform.position.x < -10)) { //disable sun shafts effect } } } how disable sun shafts effect programmatically?
if google "unity3d disable component" instantly find answer
https://unity3d.com/learn/tutorials/modules/beginner/scripting/enabling-disabling-components
yourcomponent.enabled = false; for example flawless answer 1 of best unity engineers, perfect
http://answers.unity3d.com/answers/26849/view.html
note example "if see checkbox in inspector, can enable or disable it."
note here on stackoverflow cannot change questions editing them -- don't hesitate ask new questions. ask many wish.
Comments
Post a Comment