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 Psycho8Vegemite · May 05, 2015 at 10:53 AM · c#errorgetcomponentimage effectsblur

C# GetComponent()... Not finding script problem.

I'm pretty definite that the code is correct in the way it should be used, however in this specific problem, the Blur script which is an Image Effect (and is in the correct location of Standard Assets\ImageEffects\Scripts\Blur.cs), doesn't want to be seen almost and returns with an error telling me that "The name 'Blur' does not exist in the current context".

I'm wondering if this is due to the script loading after the GameMenuPause.cs script runs itself therefore skipping it or the otherway around, causing the error of CS0103. Either that or my code is buggered somewhere. Note, this is in the newest update of Unity5 5.0.1f1 (If it is a bug with the engine itself somehow). Help would be much appreciated, thanks in advance...

The lines of errors are 24 and 29 where gameObject.GetComponent() is used.

 using UnityEngine;
 using System.Collections;
 
 public class GameMenuPause : MonoBehaviour {
 
     public bool paused;
     public Camera effectCamera;
 
     void Start () {
         Screen.lockCursor = true;
         Time.timeScale = 1f;
     }
 
     void Update () {
         if(Input.GetButtonDown("Pause")){
             if(paused){
                 paused = false;
             }else{
                 paused = true;
             } 
         }
 
         if(!paused){
             effectCamera.GetComponent<Blur>().enabled = false;
             Screen.lockCursor = true;
             Time.timeScale = 1f;
             AudioListener.pause = false;
         }else{
             effectCamera.GetComponent<Blur>().enabled = true; // Would have the enabled function to turn it on and off.
             Screen.lockCursor = false;
             Time.timeScale = 0f;
             AudioListener.pause = true;
         }
     }
 }
 

Kind Regards,

J. Tobar-Chapman

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

1 Reply

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

Answer by tanoshimi · May 05, 2015 at 10:54 AM

Image effects are defined in the UnityStandardAssets.ImageEffects namespace, so you'll need to include a reference to that at the top of your code:

 using UnityStandardAssets.ImageEffects;
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 Psycho8Vegemite · May 05, 2015 at 11:12 AM 0
Share

A legend is what you are, thanks for that mate. Works as it should.

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

2 People are following this question.

avatar image avatar image

Related Questions

Unexpected token ) when dealing with getcomponent 1 Answer

AddComponent can't find script name MouseOrbit? 1 Answer

Null Reference Exception Help 1 Answer

Unknown identifier when turning off SSAO through a JS script 1 Answer

Need to Access GlowEffect From Script and Add To "Intensity" Parameter 0 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