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 rockyourteeth · May 25, 2014 at 04:36 AM · classconsolelogwarningbehaviour

I changed the name of some scripts and now I get a warning message but scripts run fine

I changed the name of several C# scripts in my project. I made sure to change the class names in the file AND the name of the .cs files themselves to match. Running the project now works fine, but I get several console warnings logged saying "The referenced script on this Behaviour is missing!".

Does anyone know how I might resolve this, or where I might look? Double-clicking on the warning does not do anything.

Thanks!

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by calmcarrots · May 25, 2014 at 04:49 AM

First, find the object where the component is missing. When you get this error, that means a component (such as a script) is missing and Unity cannot locate it. Once you find the object that is missing your script, delete that component and replace it with the script you want.

For example, let's say that you had a PlayerController.cs script attached to your player object. Then you go and change that script to the name: PlayerMovement.cs. The player object will not contain a PlayerController.cs because it does not exist anymore. To fix that, go and click on the player object and add the new script. Your problem should be fixed.

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 Owen-Reynolds · May 25, 2014 at 05:05 PM 0
Share

Or, ins$$anonymous$$d of deleting and re-adding the script component; can click on the "none(missing)" in the component and select the renamed script. I think maybe it might remember the old public variable settings (untested.)

Then note: to see the problem, go to a scene where some object was using one of your renamed scripts. The object will now just sit there, doing nothing.

avatar image rockyourteeth · May 28, 2014 at 07:49 PM 0
Share

No, I'm pretty sure it was a Unity bug. Basically, don't change the name of your scripts once you're using them. Bad stuff happens.

@Owen Reynolds, all of the behaviors were working. Those scripts were executing correctly.

@calmcarrots, there were no scripts that said they were missing.

Basically, the way that I eventually ended up solving it was by opening up each scene that used those scripts, selecting the objects that used those scripts, and selecting "revert to prefab". Again, NOTHING changed when I did this. All settings in the editor remained the same. But this allowed me to save the scene, and after that it all ran with no problems.

So, I'm not sure if what fixed it was the "revert to prefab" thing, or if I just needed to open every scene and re-save them to get Unity to update everything under-the-hood.

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

22 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

Related Questions

How to suppress BoxCollider warning 2 Answers

How to clear a specific error/warning in the console output window? 0 Answers

Missing Behaviours still process as if they exist? 0 Answers

Class transform "null" keyword error. 1 Answer

How to redirect System.Console.Write from dll to Debug.Log 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