Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
1
Question by ChichoRD · Jul 10, 2021 at 03:19 PM · custom editorcompiler error

Project contains compiler errors

Hi, since 2 days ago whenever I open one of my Unity projects I'm getting an error while loading editor saying my project has got compiler errors and suggesting me to enter safe mode; afterwards, once in the editor I get an error message in the console saying

Init must be called first.

I want to know the reason because this is happening, hence I will comment the possible critical changes I had done the previous day to the first time getting this error:


  • Updated Unity Hub to it's newer beta version 3.0.0

  • Created an editor script for adding a button to Animator to automatically generate a class with animation parameters names as constants (class down here)


    using UnityEngine; using UnityEditor; using System.IO; using System.Linq;

    [CustomEditor(typeof(Animator))] public class AnimatorExtensionsEditor : Editor { private Animator animator;

       public override void OnInspectorGUI()
         {
             DrawDefaultInspector();
             EditorGUILayout.Space();
     
             GUILayout.Label("Animation Extras:");
     
             if (GUILayout.Button($"Generate {Selection.activeGameObject.name} animator c# class"))
             {
                 animator = Selection.activeGameObject.GetComponent<Animator>();
                 GenerateAnimatorClass(Selection.activeGameObject.name + "AnimatorParameters", animator.parameters.Select(p => p.name.Replace(' ', '_').ToUpper()).ToArray(), animator.parameters.Select(p => p.name).ToArray());
                 GUIUtility.ExitGUI();
             }
         }
     
         private void GenerateAnimatorClass(string className, string[] constantsNames, string[] constantsValues)
         {
             string path = EditorUtility.SaveFilePanel($"Generate animator class for {Selection.activeGameObject.name}", string.Empty, $"{className}.cs", ".cs");
     
             if (path == string.Empty) return;
     
             string classDeclaration = $"public static class {className}";
             string[] fields = new string[constantsNames.Length];
             string finalClass = classDeclaration + '\n' + '{' + '\n';
     
             for (int i = 0; i < fields.Length; i++)
             {
                 fields[i] = ConstDeclaration(constantsNames[i], constantsValues[i]);
                 finalClass += '\t' + fields[i] + '\n';
             }
     
             finalClass += '}';
     
             File.WriteAllText(path, finalClass);
     
             AssetDatabase.Refresh();
     
             const char apostrophe = '"';
             static string ConstDeclaration(string constName, string constValue) => $"public const string {constName} = {apostrophe}{constValue}{apostrophe};";
         }
     }
     
    
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 namcap · Jul 19, 2021 at 07:09 AM 0
Share

I'm seeing the same error and this only happened since I updated Unity Hub to the 3.0.0-beta. I would guess this is the cause based on you seeing the same thing. I did not have any other changes to my project besides that.

avatar image rage_co namcap · Jul 19, 2021 at 02:03 PM 0
Share

The new unity hub update did a lot of damage here too...basically it uninstalled my editor...after reinstalling tho..there is no real problem

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

124 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 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 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 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 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 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 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

Select between different Custom Editors for same Monobehaviour 0 Answers

How to create a textfield in custom window editor using a button? 1 Answer

How to design a terrain paint tool in script by TerrainPaintTool? 0 Answers

How to make a custom inspector to preview tile? 0 Answers

How can I get time of compiling to use used in a progress bar in a custom editor? 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