• 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 deanream22 · Nov 17, 2016 at 03:17 PM · scripting problem

Help, i think i am missing something--------- Assets/Standard Assets/Image Effects (Pro Only)/ColorCorrectionCurves.js(11,9): BCE0043: Unexpected token: public.

Script: #pragma strict @script ExecuteInEditMode @script AddComponentMenu ["Image Effects/Color Correction (Curves, Saturation)"] ;

enum ColorCorrectionMode { Simple = 0, Advanced = 1
}

class ColorCorrectionCurves extends PostEffectsBase public var redChannel : AnimationCurve; public var greenChannel : AnimationCurve; public var blueChannel : AnimationCurve;

 public var useDepthCorrection : boolean = false;
 
 public var zCurve : AnimationCurve;
 public var depthRedChannel : AnimationCurve;
 public var depthGreenChannel : AnimationCurve;
 public var depthBlueChannel : AnimationCurve;
 
 private var ccMaterial : Material;
 private var ccDepthMaterial : Material;
 private var selectiveCcMaterial : Material;
 
 private var rgbChannelTex : Texture2D;
 private var rgbDepthChannelTex : Texture2D;
 private var zCurveTex : Texture2D;
 
 public var saturation : float = 1.0f;

 public var selectiveCc : boolean = false;
 
 public var selectiveFromColor : Color = Color.white;
 public var selectiveToColor : Color = Color.white;
 
 public var mode : ColorCorrectionMode;
 
 public var updateTextures : boolean = true;        
     
 public var colorCorrectionCurvesShader : Shader = null;
 public var simpleColorCorrectionCurvesShader : Shader = null;
 public var colorCorrectionSelectiveShader : Shader = null;
         
 private var updateTexturesOnStartup : boolean = true;
     
 function Start () {
     super ();
     updateTexturesOnStartup = true;
 }
 
 function Awake () {    }
 
 function CheckResources () : boolean {        
     CheckSupport (mode == ColorCorrectionMode.Advanced);
 
     ccMaterial = CheckShaderAndCreateMaterial (simpleColorCorrectionCurvesShader, ccMaterial);
     ccDepthMaterial = CheckShaderAndCreateMaterial (colorCorrectionCurvesShader, ccDepthMaterial);
     selectiveCcMaterial = CheckShaderAndCreateMaterial (colorCorrectionSelectiveShader, selectiveCcMaterial);
     
     if (!rgbChannelTex)
          rgbChannelTex = new Texture2D (256, 4, TextureFormat.ARGB32, false, true); 
     if (!rgbDepthChannelTex)
          rgbDepthChannelTex = new Texture2D (256, 4, TextureFormat.ARGB32, false, true);
     if (!zCurveTex)
          zCurveTex = new Texture2D (256, 1, TextureFormat.ARGB32, false, true);
          
     rgbChannelTex.hideFlags = HideFlags.DontSave;
     rgbDepthChannelTex.hideFlags = HideFlags.DontSave;
     zCurveTex.hideFlags = HideFlags.DontSave;
         
     rgbChannelTex.wrapMode = TextureWrapMode.Clamp;
     rgbDepthChannelTex.wrapMode = TextureWrapMode.Clamp;
     zCurveTex.wrapMode = TextureWrapMode.Clamp;    
                 
     if(!isSupported)
         ReportAutoDisable ();
     return isSupported;          
 }    
 
 public function UpdateParameters () 
 {            
     if (redChannel && greenChannel && blueChannel) {        
         for (var i : float = 0.0f; i <= 1.0f; i += 1.0f / 255.0f) {
             var rCh : float = Mathf.Clamp (redChannel.Evaluate(i), 0.0f, 1.0f);
             var gCh : float = Mathf.Clamp (greenChannel.Evaluate(i), 0.0f, 1.0f);
             var bCh : float = Mathf.Clamp (blueChannel.Evaluate(i), 0.0f, 1.0f);
             
             rgbChannelTex.SetPixel (Mathf.Floor(i*255.0f), 0, Color(rCh,rCh,rCh) );
             rgbChannelTex.SetPixel (Mathf.Floor(i*255.0f), 1, Color(gCh,gCh,gCh) );
             rgbChannelTex.SetPixel (Mathf.Floor(i*255.0f), 2, Color(bCh,bCh,bCh) );
             
             var zC : float = Mathf.Clamp (zCurve.Evaluate(i), 0.0,1.0);
                 
             zCurveTex.SetPixel (Mathf.Floor(i*255.0), 0, Color(zC,zC,zC) );
         
             rCh = Mathf.Clamp (depthRedChannel.Evaluate(i), 0.0f,1.0f);
             gCh = Mathf.Clamp (depthGreenChannel.Evaluate(i), 0.0f,1.0f);
             bCh = Mathf.Clamp (depthBlueChannel.Evaluate(i), 0.0f,1.0f);
             
             rgbDepthChannelTex.SetPixel (Mathf.Floor(i*255.0f), 0, Color(rCh,rCh,rCh) );
             rgbDepthChannelTex.SetPixel (Mathf.Floor(i*255.0f), 1, Color(gCh,gCh,gCh) );
             rgbDepthChannelTex.SetPixel (Mathf.Floor(i*255.0f), 2, Color(bCh,bCh,bCh) );
         }
         
         rgbChannelTex.Apply ();
         rgbDepthChannelTex.Apply ();
         zCurveTex.Apply ();                
     }
 }
 
 function UpdateTextures () {
     UpdateParameters ();            
 }
 
 function OnRenderImage (source : RenderTexture, destination : RenderTexture) {
     if(CheckResources()==false) {
         Graphics.Blit (source, destination);
         return;
     }
     
     if (updateTexturesOnStartup) {
         UpdateParameters ();
         updateTexturesOnStartup = false;
     }
     
     if (useDepthCorrection)
         camera.depthTextureMode |= DepthTextureMode.Depth;            
     
     var renderTarget2Use : RenderTexture = destination;
     
     if (selectiveCc) {
         renderTarget2Use = RenderTexture.GetTemporary (source.width, source.height);
     }
     
     if (useDepthCorrection) {
         ccDepthMaterial.SetTexture ("_RgbTex", rgbChannelTex);
         ccDepthMaterial.SetTexture ("_ZCurve", zCurveTex);
         ccDepthMaterial.SetTexture ("_RgbDepthTex", rgbDepthChannelTex);
         ccDepthMaterial.SetFloat ("_Saturation", saturation);
 
         Graphics.Blit (source, renderTarget2Use, ccDepthMaterial);     
     } 
     else {
         ccMaterial.SetTexture ("_RgbTex", rgbChannelTex);
         ccMaterial.SetFloat ("_Saturation", saturation);
         
         Graphics.Blit (source, renderTarget2Use, ccMaterial);             
     }
     
     if (selectiveCc) {
         selectiveCcMaterial.SetColor ("selColor", selectiveFromColor);
         selectiveCcMaterial.SetColor ("targetColor", selectiveToColor);
         Graphics.Blit (renderTarget2Use, destination, selectiveCcMaterial);     
         
         RenderTexture.ReleaseTemporary (renderTarget2Use);
     }
 }

EOF;

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
0

Answer by tanoshimi · Nov 17, 2016 at 03:34 PM

It's very hard to tell from your code-formatting (and I don't use Unityscript), but this doesn't look right at all:

 class ColorCorrectionCurves extends PostEffectsBase public var redChannel : AnimationCurve;

Should there not be a { after the class declaration? (i.e. before the word "public")

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

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How do i instantiate a prefab with the same rotation as the gameobject? 1 Answer

[SIMPLE] How to change Layer Weight in Animator? 0 Answers

How to fix a Missing Refrence Exception Error 1 Answer

what happens when my Level Complete animation plays before i can play the level,What hapopens when my Level complete animation runs before i can play the first level 1 Answer

Change 2D box collider Y values but how offset stay on same position and adjust their values. 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