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 Groszq · Oct 03, 2012 at 05:29 PM · customeditor

Strange problem with CustomEditor

I have a problem with custom editor, becouse my script dont recognize the main script.

 using UnityEngine;
 using UnityEditor;
 using System.Collections;    
 
 [CustomEditor (typeof(audioReverbScript))]
 
 public class audioReverbEditor : Editor
 {
     public enum presetNames
     {
         Off = 1,
         Generic = 2,
         PaddedCell = 3,
         Room = 4, 
         Bathroom = 5, 
         Livingroom = 6
     }
     
     private int number;
     
     private presetNames myPresetNameItemType = presetNames.Off;
     
     public audioReverbScript script;
     
     public void OnEnable()
     {
         script = (audioReverbScript) target;
     }
     
     public override void OnInspectorGUI()
     {
         GUI.changed=false;
         myPresetNameItemType = (presetNames)EditorGUILayout.EnumPopup("Wybierz preset: ", myPresetNameItemType );
         script.presetNumber=(int) myPresetNameItemType;
         if(GUI.changed) EditorUtility.SetDirty(script);
     }
 }

And that's the error

Assets/Plugins/Editor/audioReverbEditor.cs(23,16): error CS0246: The type or namespace name `audioReverbScript' could not be found. Are you missing a using directive or an assembly reference?

Comment
Add comment · Show 6
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 Meteory · Oct 17, 2020 at 04:40 AM 0
Share

Did you find a solution for the problem?

avatar image Demigiant Meteory · Oct 17, 2020 at 11:16 AM 0
Share

Another reason why this could be happening is if audioReverbEditor.cs is inside the Plugins folder (which is a special folder) but audioReverbScript.cs is outside of it: scripts in the Plugins folder and subfolders can only communicate with other scripts inside Plugins.

avatar image Meteory Demigiant · Oct 17, 2020 at 11:32 AM 0
Share

But all the tutorials about CustomEditor say to do so and they don't have this problem. And I didn't have this issue before.

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Demigiant · Oct 03, 2012 at 05:39 PM

It seems that you simply don't have any audioReverbScript class in your project. Considering that code is case-sensitive, maybe it's AudioReverbScript?

Comment
Add comment · Show 2 · 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 Groszq · Oct 03, 2012 at 11:15 PM 0
Share

Nope, the script is ok and the code too. I had to move Editor folder outside another folder of my game project.

avatar image Demigiant · Oct 04, 2012 at 07:43 AM 0
Share

Oh that's very strange. I always keep my Editor folders inside other folders, and it works. Can I ask what version of Unity are you using, and on what platform?

avatar image
0

Answer by Bunny83 · Oct 17, 2020 at 11:28 AM

Since the question was bumped already...


You have to be careful with special folders names. The plugins subfolder belongs to a seperate compilation group that is compiled before the rest of your game code. In essence things in the plugins folder can't access anything outside the plugins folder. So if you have the editor script inside the plugins folder, your "audioReverbScript" should be inside the plugins folder as well.


ps: You really shouldn't start type names with a lower case letter. Type names in C# and Unity generally start with a capital letter and follow PascalCase. Same goes for method names. I just added this for general guidance as the OP hasn't been online for the last 5 years.

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.

Follow this Question

Answers Answers and Comments

13 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

Related Questions

Get CustomEditor for Script 0 Answers

I need help instantiateing a bullet 0 Answers

way to get all object with a certain component/script attached 3 Answers

Decreasing footstep length when key pressed 1 Answer

Code works in editor, but not in built game. 1 Answer


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