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
2
Question by DannyPaguiao · Mar 09, 2015 at 09:17 AM · unity 5ambiguous reference

Ambiguous reference 'preview'

So I made a game in Unity before I updated to Unity 5. However, as I updated my project and Unity I ran into these errors and now my game won't run and I have no idea what the errors are asking of me. Anyone have any ideas on how to fix this?

Assets/Editor/Image Effects/CameraMotionBlurEditor.js(92,36): BCE0004: Ambiguous reference 'preview': CameraMotionBlurEditor.preview, UnityEditor.Editor.preview.

Assets/Editor/Image Effects/CameraMotionBlurEditor.js(93,9): BCE0004: Ambiguous reference 'preview': CameraMotionBlurEditor.preview, UnityEditor.Editor.preview.

NavMesh asset format has changed. Please rebake the NavMesh data

 #pragma strict
 
 @CustomEditor (CameraMotionBlur)
 class CameraMotionBlurEditor extends Editor 
 {    
     var serObj : SerializedObject;    
         
   var filterType : SerializedProperty;
   var preview : SerializedProperty;
   var previewScale : SerializedProperty;
   var movementScale : SerializedProperty;
   var jitter : SerializedProperty;
   var rotationScale : SerializedProperty;
   var maxVelocity : SerializedProperty;
   var minVelocity : SerializedProperty;
   var maxNumSamples : SerializedProperty;
   var velocityScale : SerializedProperty;
   var velocityDownsample : SerializedProperty;
   var noiseTexture : SerializedProperty;
   var showVelocity : SerializedProperty;
   var showVelocityScale : SerializedProperty;
   var excludeLayers : SerializedProperty;
   //var dynamicLayers : SerializedProperty;
 
     function OnEnable () {
         serObj = new SerializedObject (target);
         
     filterType = serObj.FindProperty ("filterType");
 
     preview = serObj.FindProperty ("preview");
     previewScale = serObj.FindProperty ("previewScale");
 
     movementScale = serObj.FindProperty ("movementScale");
     rotationScale = serObj.FindProperty ("rotationScale");
 
     maxVelocity = serObj.FindProperty ("maxVelocity");
     minVelocity = serObj.FindProperty ("minVelocity");
 
     maxNumSamples = serObj.FindProperty ("maxNumSamples");
     jitter = serObj.FindProperty ("jitter");
 
     excludeLayers = serObj.FindProperty ("excludeLayers");
     //dynamicLayers = serObj.FindProperty ("dynamicLayers");
 
     velocityScale = serObj.FindProperty ("velocityScale");
     velocityDownsample = serObj.FindProperty ("velocityDownsample");
 
     noiseTexture = serObj.FindProperty ("noiseTexture");
     } 
             
   function OnInspectorGUI () {         
     serObj.Update ();
                     
     EditorGUILayout.LabelField("Simulates camera based motion blur", EditorStyles.miniLabel);
 
     EditorGUILayout.PropertyField (filterType, new GUIContent("Technique"));      
     if (filterType.enumValueIndex == 3 && !(target as CameraMotionBlur).Dx11Support()) {
       EditorGUILayout.HelpBox("DX11 mode not supported (need shader model 5)", MessageType.Info);      
     }          
     EditorGUILayout.PropertyField (velocityScale, new GUIContent(" Velocity Scale"));   
     if(filterType.enumValueIndex >= 2) {
       EditorGUILayout.LabelField(" Tile size used during reconstruction filter:", EditorStyles.miniLabel);      
       EditorGUILayout.PropertyField (maxVelocity, new GUIContent("  Velocity Max"));  
     }
     else
       EditorGUILayout.PropertyField (maxVelocity, new GUIContent(" Velocity Max"));       
     EditorGUILayout.PropertyField (minVelocity, new GUIContent(" Velocity Min"));   
 
     EditorGUILayout.Separator ();
 
     EditorGUILayout.LabelField("Technique Specific");
 
     if(filterType.enumValueIndex == 0) {
       // portal style motion blur
       EditorGUILayout.PropertyField (rotationScale, new GUIContent(" Camera Rotation"));
       EditorGUILayout.PropertyField (movementScale, new GUIContent(" Camera Movement"));
     }
     else {
       // "plausible" blur or cheap, local blur
       EditorGUILayout.PropertyField (excludeLayers, new GUIContent(" Exclude Layers"));
       EditorGUILayout.PropertyField (velocityDownsample, new GUIContent(" Velocity Downsample"));
       velocityDownsample.intValue = velocityDownsample.intValue < 1 ? 1 : velocityDownsample.intValue;
       if(filterType.enumValueIndex >= 2) { // only display jitter for reconstruction
         EditorGUILayout.PropertyField (noiseTexture, new GUIContent(" Sample Jitter"));
         EditorGUILayout.PropertyField (jitter, new GUIContent("  Jitter Strength"));
       }
     }
 
     EditorGUILayout.Separator ();
 
     EditorGUILayout.PropertyField (preview, new GUIContent("Preview"));
     if (preview.boolValue)
       EditorGUILayout.PropertyField (previewScale, new GUIContent(""));    
             
     serObj.ApplyModifiedProperties();
     }
 }
 
Comment
Add comment · Show 3
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 AlwaysSunny · Mar 09, 2015 at 04:14 AM 0
Share

Haven't played with 5 yet, so I may be way off. Perhaps re-importing your camera effects from the new Unity 5 standard assets release will solve this.

Otherwise, you may have to edit the script to qualify the ambiguous reference. Ambiguity occurs when two variables in the same scope share a name, and you must qualify them by including their class or namespace name.

So preview becomes Camera$$anonymous$$otionBlurEditor.preview or UnityEditor.Editor.preview depending on which is intended. (I don't know)

There may be other internal issues, who knows. Big releases always come with quirks and issues.

avatar image AdamAz · Mar 09, 2015 at 01:41 PM 0
Share

Had the same problem, deleting and re importing the scripts worked perfectly for me.

avatar image ReadPan_ · Jan 28, 2016 at 04:53 PM 0
Share

@TTGxINSTINCT Thank you sooooooooo much!

3 Replies

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

Answer by ptr0x · Mar 10, 2015 at 01:37 PM

I ran into the same problem.

The solution I took was modifying the 'preview' variable name to 'preview_'.

Comment
Add comment · Show 14 · 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 TTGxINSTINCT · Mar 11, 2015 at 09:25 AM 1
Share

Thanks @ptr0x worked for me! Changed

var preview : SerializedProperty; to var preview_ : SerializedProperty;

avatar image Ziron999 · Mar 11, 2015 at 09:51 PM 0
Share

make sure you get all of the lines:

preview_ = serObj.FindProperty ("preview");

EditorGUILayout.PropertyField (preview_, new GUIContent("Preview"));

if (preview_.boolValue)

avatar image Khazi Ziron999 · Oct 01, 2015 at 09:42 AM 0
Share

This helps! ^^

Thank you very much. :)

avatar image DannyPaguiao · Mar 12, 2015 at 03:39 AM 0
Share

Thank you! This fixed the problem!

avatar image Griffo · Mar 13, 2015 at 01:02 PM 0
Share

Sorted my problem to, thanks.

avatar image tyrot · Mar 23, 2015 at 08:28 PM 0
Share

dude you are AWESO$$anonymous$$E you saved the day- even the month..!

Show more comments
avatar image
1

Answer by TTGxINSTINCT · Dec 13, 2015 at 02:47 PM

@lazerdarts In your script you are most likely using the same script, just change this line


var preview : SerializedProperty;

to

var preview_ : SerializedProperty;



Now replace all instances that it uses this variable in the code. I believe it is only about 4-5 changes or less.

You can also tell what is incorrect if your using MonoDevelop, it will tell you what lines need to be changed.

Example, this line needs to be fixed from

EditorGUILayout.PropertyField (preview, new GUIContent("Preview"));

to

EditorGUILayout.PropertyField (preview_, new GUIContent("Preview"));



Notice that the preview variable changed to preview_ because thats whats declared in your variables at the top of the code. I hopes this helped!

Comment
Add comment · Show 3 · 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 lazerdarts · Dec 13, 2015 at 04:34 PM 0
Share

That worked perfectly! Thanks so much for the help! @TTGxINSTINCT

avatar image Parag-Jairath · Apr 19, 2016 at 06:41 AM 0
Share

@TTGxINSTINCT : Thanks for the response. I have figured out that there is no issue with 'Ambiguous Reference' solution, because when I checked the same scenario in an empty project, there was no issue whatsoever. (Imported Image effects in Unity3D 4.5 in a new project -> created a package for the same->Created a new empty project in Unity3D 5.1.1->Imported the created package->Resolved the 'Ambiguous Reference ' issue successfully). However, as far as I can understand this has something to do with Unity's automatic API updater. There may be other compile errors throwing these crashes. Thanks for the help again. I will update my Unity to version 5.3.4f1 and will get back to you regarding this.

avatar image tuanna222 · Sep 13, 2016 at 01:21 AM 0
Share

perfectly, thanks!

avatar image
1

Answer by $$anonymous$$ · Oct 25, 2017 at 10:17 AM

use preview_

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 $$anonymous$$ · Oct 25, 2017 at 10:17 AM 0
Share

var preview_ : SerializedProperty;

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

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

video is not playing; Using Url 0 Answers

Unity Native VR doesn't work!! 0 Answers

Unity3d v5 & Awesomium: Currently Compatible? 4 Answers

How to Limit Z Axis on my FirstPersonCamera? 1 Answer

Is it possible to send Game Center challenges to your friends using Unity's own Social API? 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