• 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 chegonenko · Aug 11, 2014 at 07:42 AM · objectaddcomponent

Can't add script

alt textI can't apply script on object. "Can't add script can't add component 'globalVar' because it doesn't exist" The same thing with standart scripts too. My friend has the same unity. Everything works fine on his computer, so I think there is no errors in script. Can anyone help me?

\My friend can apply this script on object without problems. \There are 4 scripts for making inventory. \Global var is one of them. \ Third line :" Stores global variables" \ Fourth line: " Apply on any unchangeable object I have downloaded it from one lesson on youtube. Firstly, the guy just dragged the script on a cube as an example.

безымянный.jpg (34.3 kB)
globalvar.jpg (75.3 kB)
Comment
Add comment · Show 7
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 KittenPoker · Aug 11, 2014 at 08:56 AM 0
Share

could you show your script?

avatar image markzareal · Aug 11, 2014 at 09:04 AM 1
Share

show your script otherwise we don't know how to fix it

avatar image KittenPoker · Aug 11, 2014 at 10:14 AM 0
Share

is your script called "GlobalVar" or is it called "GlobalVar Import Settings"? The saved as name of the script & the name of the class need to be the same.

avatar image chegonenko · Aug 11, 2014 at 10:16 AM 0
Share

$$anonymous$$y script is called GlobalVar. I don't know why, but inspector calls it "GlobalVar Import Settings"

avatar image Ekta-Mehta-D · Aug 11, 2014 at 10:19 AM 0
Share

Thats not a problem. Ur script name is "GlobalVar" only.

avatar image gjf · Aug 11, 2014 at 10:29 AM 0
Share

when posting code, please post the actual code and not screenshots. highlight the entire code section and then press the 101/010 button to format the code properly.

that way it's easier for people helping you to read it, and it's also possible for them to copy the code to test things - also to help you.

avatar image 0_osmile0_o · Aug 11, 2014 at 10:46 AM 0
Share

If you could send a link to the tutorial I might figure it out although I am a noob myself (I presume the tutorial is in Russian? That's no problem for me as I am Russian myself).

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Shamini · Aug 11, 2014 at 10:57 AM

have you changed the name of the script.because you have mentioned the name 'globalVar' whereas the name of the class inside the script is 'GlobalVar'.your class name and name of the script must be the same.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

add class or script to child gameObjects 1 Answer

Auto Build Script 2 Answers

GetType is Monoscript, how to implement correctly? store type in variable? 1 Answer

Display Press E to Pickup when mouse over object 2 Answers

Float seen as Object, help? 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