Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

ImageEffectBase in Unity 5?

Discussion in 'Scripting' started by Studio_Akiba, Mar 31, 2015.

  1. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    I am getting the following error on an image effect script, which worked in previous version, I am wondering if the namespace for ImageEffects have changed, although PostEffectsBase does not work either.

    Assets/Glitch/GlitchEffect.cs(17,29): error CS0246: The type or namespace name `ImageEffectBase' could not be found. Are you missing a using directive or an assembly reference?

    The project files are originally from here:
    https://github.com/staffantan/unityglitch
     
  2. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    It did change. It's in "UnityStandardAssets.ImageEffects" now.
     
  3. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    I have changed the class to ImageEffects and added "using UnityStandardAssets" to the top, but am now receiving this error:

    Assets/Glitch/GlitchEffect.cs(18,29): error CS0246: The type or namespace name `ImageEffects' could not be found. Are you missing a using directive or an assembly reference?
     
  4. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I mean the namespace is "UnityStandardAssets.ImageEffects" and the class is still ImageEffectBase. Like this:

    Code (csharp):
    1. using UnityStandardAssets.ImageEffects;
    2.  
    3. public class MyClass : ImageEffectBase { }
    Also, make sure you actually have the ImageEffects asset imported from Standard Assets.
     
    babarr and Raveerojh like this.
  5. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Ah that did it, thank you.
     
  6. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    Sorry to repost, but I have the same problem with a JS script.
    Changing using to Import doesn't work and just presents me with about 5 more errors, is there an equivalent line?
     
  7. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    It might be because Javascript in the Standard Assets folder will compile before C# in the Standard Assets folder, so it can't access C# classes. Make sure your Javascript file is not in the Standard Assets or Plugin folder. But the original Unity Standard Assets do need to be in the Standard Assets folder.
     
  8. Sushimon2001

    Sushimon2001

    Joined:
    Aug 4, 2015
    Posts:
    4
    Sorry to bump the thread, but after editing the code like how you mentioned, I received the following error:
    "Assets/Glitch/GlitchEffect.cs(17,5): error CS8025: Parsing error"
    Line 17 contains the following:
    Code (csharp):
    1. using UnityStandardAssets.ImageEffects;
    Do you think you could help?

    Edit: There is a typo line over the "using" in the line not working, saying something about an unexpected symbol "using"
     
    Last edited: Aug 4, 2015
  9. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    The file is C#; maybe you're trying to use UnityScript? Make sure you create it as a C# script file in Unity. Or if you want to use UnityScript change "using" to "import".
     
  10. Sushimon2001

    Sushimon2001

    Joined:
    Aug 4, 2015
    Posts:
    4
    Capture.PNG
    I'm using the default script editor, and I was using the original .cs file that was in the package, if this information helps.
    It's listed as a C# code in Unity.
     
  11. DonLoquacious

    DonLoquacious

    Joined:
    Feb 24, 2013
    Posts:
    1,667
    Put it at the top of the script (above [Execute...]) and make sure the attributes are directly over the class they're supposed to be defining attributes for.
     
  12. Sushimon2001

    Sushimon2001

    Joined:
    Aug 4, 2015
    Posts:
    4
    Capture2b.PNG Capture2.PNG
    Seems that made it worse.
    Do you think you could upload a working .cs file here instead?
     
  13. DonLoquacious

    DonLoquacious

    Joined:
    Feb 24, 2013
    Posts:
    1,667
    Absolutely not. Your line 16 there has braces that's supposed to enclose the class { } except it's enclosing nothing. Delete the end brace and move it down to the bottom of the file.
     
  14. Sushimon2001

    Sushimon2001

    Joined:
    Aug 4, 2015
    Posts:
    4
    That worked! Thank you so much!
     
  15. Raveerojh

    Raveerojh

    Joined:
    Nov 28, 2016
    Posts:
    2
    Thank you very much for your answer!