Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Endless CameraMotionBlur Script Error. One sentence is fixed, two more errors occur.

Discussion in 'Scripting' started by MegaBadger24, May 13, 2015.

  1. MegaBadger24

    MegaBadger24

    Joined:
    May 6, 2015
    Posts:
    9
    Forgive me for being new to game development if this problem is an easy fix. I was working on an original concept when this halted me from testing my level. The endless CameraMotionBlur script error began after I resolved the "dll access denied" error by uninstalling MacAfee. I first got a notification that preview values were not recognized. I solved this by changing "Preview" to "Preview_" for all lines that contained the phrase. Right after I solved that issue, I received errors such as these:

    "C:\Users\NAME\Documents\Game\New Unity Project\Assets\Editor\Image Effects\CameraMotionBlurEditor.js(86,86): Error UCE0001: ';' expected. Insert a semicolon at the end. (UCE0001) (Assembly-UnityScript-Editor)"

    "C:\Users\NAME\Documents\Game\New Unity Project\Assets\Editor\Image Effects\CameraMotionBlurEditor.js(85,85): Error BCE0044: expecting ), found ';'. (BCE0044) (Assembly-UnityScript-Editor)"

    These weren't the first ones that came up, I've been battling similar errors and I will fix and end up creating new ones. The most confusing part of this issue is that I'm not even using the CameraMotionBlur effect at the moment. I would really like to know how to solve this issue because i'm anxious to going through with my first game. (all though taking my time into developing the project and not doing so for the sake of making a quick buck).

    The script as it currently stands:

    Code (CSharp):
    1. #pragma strict
    2. @CustomEditor (CameraMotionBlur)
    3. class CameraMotionBlurEditor extends Editor
    4. {
    5. var serObj : SerializedObject;
    6.  
    7. var filterType : SerializedProperty;
    8. var preview_ : SerializedProperty;
    9. var preview_Scale : SerializedProperty;
    10. var movementScale : SerializedProperty;
    11. var jitter : SerializedProperty;
    12. var rotationScale : SerializedProperty;
    13. var maxVelocity : SerializedProperty;
    14. var minVelocity : SerializedProperty;
    15. var maxNumSamples : SerializedProperty;
    16. var velocityScale : SerializedProperty;
    17. var velocityDownsample : SerializedProperty;
    18. var noiseTexture : SerializedProperty;
    19. var showVelocity : SerializedProperty;
    20. var showVelocityScale : SerializedProperty;
    21. var excludeLayers : SerializedProperty;
    22. //var dynamicLayers : SerializedProperty;
    23. function OnEnable () {
    24. serObj = new SerializedObject (target);
    25.  
    26. filterType = serObj.FindProperty ("filterType");
    27. preview_ = serObj.FindProperty ("preview_");
    28. preview_Scale = serObj.FindProperty ("preview_Scale");
    29. movementScale = serObj.FindProperty ("movementScale");
    30. rotationScale = serObj.FindProperty ("rotationScale");
    31. maxVelocity = serObj.FindProperty ("maxVelocity");
    32. minVelocity = serObj.FindProperty ("minVelocity");
    33. maxNumSamples = serObj.FindProperty ("maxNumSamples");
    34. jitter = serObj.FindProperty ("jitter");
    35. excludeLayers = serObj.FindProperty ("excludeLayers");
    36. //dynamicLayers = serObj.FindProperty ("dynamicLayers");
    37. velocityScale = serObj.FindProperty ("velocityScale");
    38. velocityDownsample = serObj.FindProperty ("velocityDownsample");
    39. noiseTexture = serObj.FindProperty ("noiseTexture");
    40. }
    41.  
    42. function OnInspectorGUI () {
    43. serObj.Update ();
    44.  
    45. EditorGUILayout.LabelField("Simulates camera based motion blur", EditorStyles.miniLabel);
    46. EditorGUILayout.PropertyField (filterType, new GUIContent("Technique"));
    47. if (filterType.enumValueIndex == 3 && !(target as CameraMotionBlur).Dx11Support()) {
    48. EditorGUILayout.HelpBox("DX11 mode not supported (need shader model 5)" (MessageType.Info),
    49.  
    50. EditorGUILayout.PropertyField (velocityScale, new GUIContent(" Velocity Scale"));
    51. if(filterType.enumValueIndex >= 2) {
    52. EditorGUILayout.LabelField(" Tile size used during reconstruction filter:", EditorStyles.miniLabel);
    53. EditorGUILayout.PropertyField (maxVelocity, new GUIContent(" Velocity Max"));
    54. }
    55. else
    56. EditorGUILayout.PropertyField (maxVelocity, new GUIContent(" Velocity Max"));
    57. EditorGUILayout.PropertyField (minVelocity, new GUIContent(" Velocity Min"));
    58. EditorGUILayout.Separator ();
    59. EditorGUILayout.LabelField("Technique Specific");
    60. if(filterType.enumValueIndex == 0) {
    61. // portal style motion blur
    62. EditorGUILayout.PropertyField (rotationScale, new GUIContent(" Camera Rotation"));
    63. EditorGUILayout.PropertyField (movementScale, new GUIContent(" Camera Movement"));
    64. }
    65. else {
    66. // "plausible" blur or cheap, local blur
    67. EditorGUILayout.PropertyField (excludeLayers, new GUIContent(" Exclude Layers"));
    68. EditorGUILayout.PropertyField (velocityDownsample, new GUIContent(" Velocity Downsample"));
    69. velocityDownsample.intValue = velocityDownsample.intValue < 1 ? 1 : velocityDownsample.intValue;
    70. if(filterType.enumValueIndex >= 2) { // only display jitter for reconstruction
    71. EditorGUILayout.PropertyField (noiseTexture, new GUIContent(" Sample Jitter")),
    72. EditorGUILayout.PropertyField (jitter, new GUIContent(" Jitter Strength"));
    73. }
    74. }
    75. EditorGUILayout.Separator ();
    76. EditorGUILayout.PropertyField (preview_, new GUIContent("Preview_"));
    77. if (preview_.boolValue)
    78. EditorGUILayout.PropertyField (preview_Scale, new GUIContent("Preview_"));
    79.  
    80. serObj.ApplyModifiedProperties();
    81. }
    82. }
    83. }
     

    Attached Files:

    Last edited: May 13, 2015
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    firstly, [ code] [ /code] tags when pasting code into the forums... formats it nicely (there is a sticky about it and everything).

    the errors referring to ";" are pretty much always formatting/syntax errors (i.e. "spellcheck needed" from a code point of view :rolleyes:). Really not going to plough through the unformatted code above, but check you've ended lines with ";" and not put any where they shouldn't be.

    Lines number of 85/86 in those errors so it's somewhere around there (again, not code tags, no line numbers, aint counting them manually!)
     
  3. MegaBadger24

    MegaBadger24

    Joined:
    May 6, 2015
    Posts:
    9
    Deep apologies and thanks for the suggestion. Though I have spellchecked quite a few lines as to remind that these aren't the first messages. This all started when I updated to Unity 5 :/
     
  4. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    line 50 in the above is missing a ")" towards the end

    line 71 ends in a "," when it should end in a ";"

    I'd recommend you try to format your code a little more "cleanly", if you are going to have a function over many lines try to lay our each parameter on each line so something like this:

    Code (csharp):
    1.  
    2.     EditorGUILayout.HelpBox(
    3.                             "DX11 mode not supported (need shader model 5)" (MessageType.Info),
    4.                             EditorGUILayout.PropertyField (
    5.                                                             velocityScale,
    6.                                                             new GUIContent(" Velocity Scale")
    7.                                                             )
    8.                             );
    9.  
    10.  
    white space is good for readability and doesn't cause too many issues when the code is compiled (might if you really really need performance but for the most part it's a non impact).
     
  5. MegaBadger24

    MegaBadger24

    Joined:
    May 6, 2015
    Posts:
    9
    How's this?

    Code (CSharp):
    1.    EditorGUILayout.LabelField("Simulates camera based motion blur", EditorStyles.miniLabel);
    2.  
    3.     EditorGUILayout.PropertyField (filterType, new GUIContent("Technique"));    
    4.     if (filterType.enumValueIndex == 3 && !(target as CameraMotionBlur).Dx11Support()) {
    5.       EditorGUILayout.HelpBox(
    6.                               "DX11 mode not supported need shader model 5)" (MessageType.Info),    
    7.                                EditorGUILayout.PropertyField (
    8.                                                               velocityScale,
    9.                                                               new GUIContent(" Velocity Scale")
    10.                                                               )
    11.                    
    12.                               );
    13.                              
     
  6. MegaBadger24

    MegaBadger24

    Joined:
    May 6, 2015
    Posts:
    9
    I do want to point out that line 60 now has an error (and now the only error) stating "It is not possible to invoke an expression 'String'.

    Code (CSharp):
    1.   "DX11 mode not supported need shader model 5)" (MessageType.Info),      
     
    Last edited: May 13, 2015