Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by KurtBeley · Jan 20, 2013 at 10:05 PM · imagetoggleeffects

Toggle image effects

Is there a way to toggle image effects of a Main Camera? I want to make it so that in my game there is an explosion and when this is triggered, some of the image effects on the Main Camera are disabled. Also I may wish to enable different image effects. How can this be done?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by SrBilyon · Apr 06, 2013 at 08:31 PM

If you know the type of image effect you want to manipulate, you could enable/disable the effect. For example: If I want to disable a Color Correction image effect:

 Camera.mainCamera.GetComponent<ColorCorrectionCurves>().enabled = false;

I get the effect from the main camera and disable it.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image awesomeaustin316 · Oct 06, 2014 at 04:59 AM 0
Share

I think this is the simplest answer I've ever seen for this. Thank you sir

avatar image 26PM · Mar 15, 2016 at 01:29 PM 1
Share

Thank you @SirVictory. A great lead. Required some small changes so it wouldn't spit out an error in unity 5.2.3f1 . This worked for me:

 Camera.main.GetComponent(VignetteAndChromaticAberration).enabled=false;
 
avatar image KUFgoddess · Dec 05, 2016 at 09:59 PM 0
Share

Hello I am trying to make my player with the tag Player, walk into a cube that is set to IsTrigger and then activate the VignetteAndChromaticAberration component that is attached to the $$anonymous$$ainCamera then yield and WaitForSeconds (2 seconds) and then disable the VignetteAndChromaticAberration component. I feel like i'm getting close but I do not fully understand it and I have tried to search around UA and google.

my script is not working I was just trying to read the manual and scripting API.

 using System.Collections; 
 using System.Collections.Generic; 
 using UnityEngine;
 using UnityStandardAssets.ImageEffects;
 
 public class StartTriggerEffect : $$anonymous$$onoBehaviour {
 
  public VignetteAndChromaticAberration vig;
 
  // Use this for initialization
  void Start() {
      Camera.main.GetComponent<VignetteAndChromaticAberration>.enabled = false;
  }
 
  // Update is called once per frame
  public void OnTriggerEnter(Collider other)
  {
      if (other.tag == "Player")
      {
          vig.enabled = true;
          yield WaitForSeconds(2);
          vig.enabled = false;
         
      }
  }
 }
avatar image
-2

Answer by Carvuh · Apr 07, 2013 at 03:14 AM

wouldnt it just be:

 var gameObject : GameObject;
 var effect_script : SCRIPT_NAME_HERE;
 if (Input.GetKeyDown(KeyCode.E)) {
      //Or you could assign this to a trigger.
      gameObject.GetComponent(effect_script).enabled = false;
 }

I believe so.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

15 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

ImageEffects-toggling through code issues 0 Answers

Option to toggle SSAO in game? [Solved] 1 Answer

Changing Glow Intensity on deltatime 1 Answer

How do I access the 'Shader' property of the Greyscale Effect? 1 Answer

How do I combine cameras with image effects 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges