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 Caelorum · Sep 23, 2014 at 09:19 PM · componentadd

Can't add script (Doesn't exist?)

So I've been working on the unity scripting tutorials, trying to learn, and now I'm getting incredibly angry at this issue. I started working on the "Enabling Components" part of the tutorial. Commented everything out, made some new voids, and input the code exactly as I was told.

Now all of the sudden my scripts don't exist. I tried deleting the script and pasting the info in a new script.I tried cleaning the build, then rebuilding it. I tried making an ENTIRELY new project with new scripts. And that worked for all of 30 seconds, then it crapped out again.

I see the script, it's there, there are no issues. Why can I not attach it to anything.

alt text

stupidcrap.png (363.3 kB)
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

2 Replies

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

Answer by tanoshimi · Sep 23, 2014 at 09:26 PM

Your file is called NewBehaviorScript.cs but the class you've defined inside it is called Unity. Classes must match their filename. Also, it's a really bad idea to call a class Unity, since that's the namespace used for all the built in API classes anyway.

So, right-click to create a new script. The default name should be NewBehaviorScript, but you can change it if you like. If you change it during creation, the class template inside will automatically be changed to match the filename. If you change it at a later time, be sure to update both the class definition and the filename.

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 Caelorum · Sep 23, 2014 at 09:45 PM 0
Share

Wait, really? So how does anyone make multiple classes then? I never knew this. Thank you for your help. Like a lot. I was losing my $$anonymous$$d.

avatar image tomatosource · Feb 24, 2015 at 04:38 AM 0
Share

Just thought I'd add the other cause of this issue - check the console to see if there are any compile errors. If there are you won't be able to add any scripts until these are resolved.

avatar image
0

Answer by drudiverse · Aug 22, 2015 at 02:14 PM

I am having this problem when i "create js" called newbehaviour script (empty start and update functions)... and i copy it to an object... sry script doesnt exist.

so somewhere unity has become deeply humorous in a satanic dimension and it is trhsting errors in by botty.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Add material component to object script-wise 4 Answers

Accessing a function within a script assinged in inspector. 3 Answers

GetComponent(Script) Error(Won't detect script) 0 Answers

Reference Not Set toInstance of Object 1 Answer

How to assign "data" in script at runtime 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