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 Alanj2007 · Nov 10, 2013 at 05:57 AM · shaderdisableenable

Enable/Disable shader on script

So, I'm working on action horror game. There is an enemy in this game. I want when the enemy attack, (this shader) will be enabled on camera.

However I am unsure of how to disable/enable the shader in the camera, anyone has any idea how?

Comment
Add comment · Show 2
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 DaveA · Nov 10, 2013 at 06:49 AM 0
Share

What do you mean by 'enable shader on script'? Shaders are on materials. What do you mean by 'on camera'?

avatar image Alanj2007 · Nov 10, 2013 at 06:52 AM 0
Share

I see a lot of games when you being hitted by something, they will use this special effects on camera and I'm pretty sure they use shader.

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Cains · Nov 10, 2013 at 06:59 AM

Understand that a shader is sort of like a template for a material, telling the camera how to actually "see" the material. Because shaders are merely templates, you can't actually enable or disable them (you shouldn't even need to alter them during runtime).

However the material, which is the instance of a shader given to the GameObject, can be altered to suit your needs. You can switch the shader your material is using with Shader.Find, you can actually enable/disable the renderer displaying your GameObject like shown here, or you can set the attributes of the material using renderer.material.

If you have any questions feel free to ask and if you want to know what to do in your specific situation then elaborate more on what you want done in your game like the actual effect you're trying to create. An example of a game using the effect would be very helpful.

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
avatar image
0

Answer by tanoshimi · Nov 10, 2013 at 07:35 AM

I suspect from your description that you may be thinking of an image effect rather than a shader. They are similar in many respects, but rather than change how an individual material on an object is drawn to the screen, an image effect alters the entire image rendered by a camera.

Image effects can be used for things like adding dirt to a lens, adding blurs and depth of field effects etc. However, note that they are only available in Unity Pro.

Either that, or you might be able to create the effect you want by placing a transparent plane or GUITexture in front of the camera, and applying effects to that. For an example, see @aldonaletto's answer in http://answers.unity3d.com/questions/189677/blood-damage-like-call-of-duty.html

Comment
Add comment · Show 1 · 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 Alanj2007 · Nov 10, 2013 at 07:37 AM 0
Share

I do have Unity Pro and I did that. Thanks.

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

20 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

Fade an object in and out 0 Answers

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Enable/Disable AI script 1 Answer

Help With Disabling/Enabling single GameObject 1 Answer

[Solved]cant disable/enable scripts 1 Answer


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