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 smovie9 · Sep 08, 2014 at 06:45 PM · errornamespace

Error The namespace '' already contains a definition for 'AAMode'.

I get this error : BCE0132: The namespace '' already contains a definition for 'AAMode'. I tried a lot of options but I can't find the solution!

 #pragma strict
     
     @script ExecuteInEditMode
     @script RequireComponent (Camera)
     @script AddComponentMenu ("Image Effects/Antialiasing (Fullscreen)")
     
     enum AAMode {
         FXAA2 = 0,
         FXAA3Console = 1,        
         FXAA1PresetA = 2,
         FXAA1PresetB = 3,
         NFAA = 4,
         SSAA = 5,
         DLAA = 6,
     }
     
     class AntialiasingAsPostEffect extends PostEffectsBase  {
         public var mode : AAMode = AAMode.FXAA3Console;
     
         public var showGeneratedNormals : boolean = false;
         public var offsetScale : float = 0.2;
         public var blurRadius : float = 18.0;
     
         public var edgeThresholdMin : float = 0.05f;
         public var edgeThreshold : float = 0.2f;
         public var edgeSharpness : float  = 4.0f;
             
         public var dlaaSharp : boolean = false;
     
         public var ssaaShader : Shader;
         private var ssaa : Material;
         public var dlaaShader : Shader;
         private var dlaa : Material;
         public var nfaaShader : Shader;
         private var nfaa : Material;    
         public var shaderFXAAPreset2 : Shader;
         private var materialFXAAPreset2 : Material;
         public var shaderFXAAPreset3 : Shader;
         private var materialFXAAPreset3 : Material;
         public var shaderFXAAII : Shader;
         private var materialFXAAII : Material;
         public var shaderFXAAIII : Shader;
         private var materialFXAAIII : Material;
             
         function CurrentAAMaterial () : Material
         {
             var returnValue : Material = null;
     
             switch(mode) {
                 case AAMode.FXAA3Console:
                     returnValue = materialFXAAIII;
                     break;
                 case AAMode.FXAA2:
                     returnValue = materialFXAAII;
                     break;
                 case AAMode.FXAA1PresetA:
                     returnValue = materialFXAAPreset2;
                     break;
                 case AAMode.FXAA1PresetB:
                     returnValue = materialFXAAPreset3;
                     break;
                 case AAMode.NFAA:
                     returnValue = nfaa;
                     break;
                 case AAMode.SSAA:
                     returnValue = ssaa;
                     break;
                 case AAMode.DLAA:
                     returnValue = dlaa;
                     break;    
                 default:
                     returnValue = null;
                     break;
                 }
                 
             return returnValue;
         }
     
         function CheckResources () {
             CheckSupport (false);
             
             materialFXAAPreset2 = CreateMaterial (shaderFXAAPreset2, materialFXAAPreset2);
             materialFXAAPreset3 = CreateMaterial (shaderFXAAPreset3, materialFXAAPreset3);
             materialFXAAII = CreateMaterial (shaderFXAAII, materialFXAAII);
             materialFXAAIII = CreateMaterial (shaderFXAAIII, materialFXAAIII);
             nfaa = CreateMaterial (nfaaShader, nfaa);
             ssaa = CreateMaterial (ssaaShader, ssaa); 
             dlaa = CreateMaterial (dlaaShader, dlaa); 
                     
             if(!ssaaShader.isSupported) {
                 NotSupported ();
                 ReportAutoDisable ();
             }
             
             return isSupported;                    
         }
     
         function OnDisable()
         {
             if(materialFXAAPreset2)
                 Destroy(materialFXAAPreset2);
             if(materialFXAAPreset3)
                 Destroy(materialFXAAPreset3);
             if(materialFXAAII)
                 Destroy(materialFXAAII);
             if(materialFXAAIII)
                 Destroy(materialFXAAIII);
             if(nfaa)
                 Destroy(nfaa);
             if(ssaa)
                 Destroy(ssaa);
             if(dlaa)
                 Destroy(dlaa);
         }
         
         function OnRenderImage (source : RenderTexture, destination : RenderTexture) {
             if(CheckResources()==false) {
                 Graphics.Blit (source, destination);
                 return;
             }
                     
              // .............................................................................
             // FXAA antialiasing modes .....................................................
             
             if (mode == AAMode.FXAA3Console && (materialFXAAIII != null)) {
                 materialFXAAIII.SetFloat("_EdgeThresholdMin", edgeThresholdMin);
                 materialFXAAIII.SetFloat("_EdgeThreshold", edgeThreshold);
                 materialFXAAIII.SetFloat("_EdgeSharpness", edgeSharpness);        
             
                 Graphics.Blit (source, destination, materialFXAAIII);
             }        
             else if (mode == AAMode.FXAA1PresetB && (materialFXAAPreset3 != null)) {
                 Graphics.Blit (source, destination, materialFXAAPreset3);
             }
             else if(mode == AAMode.FXAA1PresetA && materialFXAAPreset2 != null) {
                 source.anisoLevel = 4;
                 Graphics.Blit (source, destination, materialFXAAPreset2);
                 source.anisoLevel = 0;
             }
             else if(mode == AAMode.FXAA2 && materialFXAAII != null) {
                 Graphics.Blit (source, destination, materialFXAAII);
             }
             else if (mode == AAMode.SSAA && ssaa != null) {
     
             // .............................................................................
             // SSAA antialiasing ...........................................................
                 
                 Graphics.Blit (source, destination, ssaa);                                
             }
             else if (mode == AAMode.DLAA && dlaa != null) {
     
             // .............................................................................
             // DLAA antialiasing ...........................................................
             
                 source.anisoLevel = 0;    
                 var interim : RenderTexture = RenderTexture.GetTemporary (source.width, source.height);
                 Graphics.Blit (source, interim, dlaa, 0);            
                 Graphics.Blit (interim, destination, dlaa, dlaaSharp ? 2 : 1);
                 RenderTexture.ReleaseTemporary (interim);                    
             }
             else if (mode == AAMode.NFAA && nfaa != null) {
     
             // .............................................................................
             // nfaa antialiasing ..............................................
                 
                 source.anisoLevel = 0;    
             
                 nfaa.SetFloat("_OffsetScale", offsetScale);
                 nfaa.SetFloat("_BlurRadius", blurRadius);
                     
                 Graphics.Blit (source, destination, nfaa, showGeneratedNormals ? 1 : 0);                    
             }
             else {
                 // none of the AA is supported, fallback to a simple blit
                 Graphics.Blit (source, destination);                                
             }
         }
     }

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 roojerry · Sep 08, 2014 at 07:05 PM 0
Share

'AA$$anonymous$$ode' is defined in another script somewhere within the same namespace. Search your project files and make sure that enum is only defined once.

avatar image smovie9 · Sep 09, 2014 at 06:38 PM 0
Share

ok thank you!

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

error CSO246: The type or namespace "Nunit" could not be found. 0 Answers

ArrayList declaration 1 Answer

Can you help me find the script error please? 1 Answer

Unity fails to recognize Maya models/Unity scenes 1 Answer

namespace could not be found 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