Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 infiniteWin · Nov 28, 2019 at 05:59 PM · unity 4

Is there a way to save my project?

I was making my first unity project using this tutorial: I had a problem similar to this one: https://forum.unity.com/threads/general-problem-with-scripts-the-associated-script-cannot-be-loaded.185994/ And this one: https://answers.unity.com/questions/479572/the-namespace-global-already-contains-a-definition.html And this one: https://forum.unity.com/threads/the-script-needs-to-derive-from-monobehavior.568876/

The all three of these I tried to fix by making new script files and names for each script and it "fixed" everything but now I have a problem where it asks me to first fix the compile error but no compile error shows up when compiling (I'm using sublime text 3 and it normally shows me all the errors). This has gotten to the point where this:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class Main_Control : MonoBehaviour
 {
 
 }

Gives a compile error when trying to add it as a component. I have run out of ideas for how to fix this. I can send the project files if someone suggests how.

,

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

4 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Ermiq · Dec 01, 2019 at 08:36 AM

I have this Fix compile errors that don't actually exist everytime when I change class names or class file names. While in VS Code it's all fine and no errors, Unity says there are errors. Unity shows the errors on the scripts in inspector and doesn't let to attach new scripts (which are old ones actually but with the names changed).


Usually I just remove broken scripts from gameObject in inspector, close VS Code, sometimes close Unity, then attach new scripts to gameObjects again. Don't know the exact algorithm though, just try and error method.


By the way, sometimes all that needed is just to rename the class file name to the same name as the class after it has changed.


P.S., even with this issue, Unity is still way more forgiving and easy to fix than UE4, renaming or deleting classes and files in UE4 is a real nightmare and you can easily just lose the whole project because UE4 editor won't load at all if something like this happens, you can't fix the compile errors in IDE because in IDE it all compiles just fine, but UE4 just doesn't load and throws `Fix compile errors' immediately.

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
avatar image
1

Answer by oTaijjo · Dec 01, 2019 at 08:49 AM

As @Ermiq suggested. I also would check, if the .cs file has the same name as the class. Unity needs those things to match, i.e. If your class is called MyClass then the script file should be named MyClass.cs.

If that doesn't help. Deleting the library folder, which will cause the whole project to be reimported, fixes nearly 90% of all my unexplainable issues.

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
avatar image
0

Answer by pantang · Dec 01, 2019 at 06:17 AM

Do you have another script with "public class Main_Control : MonoBehaviour" in the file as these need to be unique to the file.

you can easily manage projects with unity hub if you are starting different ones.

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 infiniteWin · Dec 01, 2019 at 12:07 PM 0
Share

Yes, I do have monobehaviour

avatar image
0

Answer by infiniteWin · Dec 01, 2019 at 12:06 PM

Thank you for both of your replies but sublime text usually shows me errors and it doesn't explain why new scripts which I haven't modified are affected

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

118 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

Related Questions

Draw Calls increased after I upgraded to 4.0 1 Answer

Unity 4 drag and drop no longer works? 1 Answer

Three ingame buttons conflict with each other on iOS 0 Answers

Why does my trigger-collider receive Enter but not Stay or Exit? 1 Answer

Edit font texture (unity 4) for adding special effects. 2 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