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
0
Question by robin_hood · Feb 22, 2015 at 10:00 PM · javascriptimageeffect

Image effect on button down

how to you have an image effect on a button down? I'm new with unity and i don't know where to start.I'm trying to make a color correction happen when you press z.

Comment
Add comment · Show 5
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 The Red Mohawk · Feb 22, 2015 at 10:47 PM 1
Share

To get you started:

 void Update(){
     if(Input.Get$$anonymous$$eyDown("Z"))
     {*your code here*}
 }

You need to assign a meaning to "Z" by going to Edit->Project Settings->Input

avatar image badatnames16 · Feb 23, 2015 at 12:22 AM 0
Share

"your code here" is what you want the script to do.

avatar image IvovdMarel · Feb 23, 2015 at 12:57 AM 0
Share

Let's just correct that real quick:

  void Update(){
      if(Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.Z))
      {
            //Your code here
      }
  }
avatar image The Red Mohawk · Feb 23, 2015 at 01:52 AM 0
Share

To clarify: Nobody can answer because you did a really bad job at submitting a clear question.

No one can tell you how to make your 'image effect' or 'color correction' because you didn't specify what is supposed to happen.

You can't just write vague stuff like 'move player forward' in code, what you can write is 'take gameobject 'player' and move it with a speed of X in the direction it is facing'.

If you want people do make the effort to help you, you should first make the effort to make it as easy as you can to help you.

avatar image robin_hood · Feb 23, 2015 at 08:21 AM 0
Share

I'm sorry, i'm new to unity and this website, i guess i didn't clarify properly . What i need it for when the "Z" button is pressed it applies a color correction or some other effect that will sharpen the colors. $$anonymous$$y game is a robin hood themed s$$anonymous$$lth game. The main character has a focus ability that when the z button is pressed it zooms in ,and sharpens the colors. I really am sorry for the inconvenience

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by skylem · Feb 23, 2015 at 08:49 AM

you can access all components in unity through scripting Anything u see in your InspectorWindow(the window that holds ur transform), some of these components include MeshRenderers and there corrosponding materials, as u may or may not be aware a material holds data for the objects texture and color u could simply change the color of a material or you could change the material itself, i don't know exactly what u mean by "Color Correction" but i'd hazard a guess that a Material is what you need heres an example

 public MeshRenderer mesh; // drag/drop the object we want to affects color to this field in the inspector.
 public Material newmat; //drag/drop the material we change to here.
 public Color custColor; // if we just want to change the color.
 
 
 // place the following in update
 
 if(Input.GetKeyDown(Keycode.Tab)) {
     mesh.material = newmat;
     // or if we just want to change the current materials color
      mesh.material.color = custColor;
 }
   

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 The Red Mohawk · Feb 24, 2015 at 02:30 AM 0
Share

http://docs.unity3d.com/$$anonymous$$anual/comp-ImageEffects.html

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

6 People are following this question.

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

Related Questions

Setting Scroll View Width GUILayout 1 Answer

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Shotgun using array/list in Javascript 1 Answer

How to let my gun shoot ?? 0 Answers

turning a game object on trigger (Javascript) 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