• 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 C10110 · Mar 23, 2014 at 08:22 PM · namespaceglobal

Can't Call Upon "global" for

Hello all.

I have a very simple problem that is making me feel very stupid.

I have a simple script, the script itself does not really matter. What matters is I'm getting a parsing error. At the top of the script I was calling upon a public class to use "Trigger" like so:


EDIT: For anyone wondering I was way over thinking this. I wish I could delete my post. I feel like I'm a waste of server space at this time. It was so simple. I was supposed to use public class TriggerManager* for my MonoBehaviour. I had two scripts that work alongside each other, and one uses a Trigger class, the other uses a TriggerManager class. I named the TriggerManager class just Trigger. Hence why I was getting the error I was. Sorry for wasting the peoples time who looked at this question. Maybe this will help someone who is as foolish as I was in the future.

 public class Trigger : MonoBehaviour 

However once my code compiled I got an error saying that "the namespace 'global namespace' already contains a definition for Trigger." What's weird is I can't call upon "global" to make global namespace happen. When I put "global namespace" in any way shape or form I get a parsing error for global, as it had no completions found. For example:

alt text

This is surprisingly giving me a very hard time. I'm sure someone knows exactly what's going on here. It feels to me like it's painfully simple to solve, but I'm just not seeing the solution. Thanks for your time!

global namespace.png (3.5 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

1 Reply

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

Answer by getyour411 · Mar 23, 2014 at 09:01 PM

Don't use 'Trigger' as the public class name

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 C10110 · Mar 23, 2014 at 09:10 PM 0
Share

Sorry, I didn't see your post when I edited my post! I came to that conclusion a little while after posting. Thank you for taking the time to answer this though. It still means a lot when a question gets answered. I tend to panic anytime my code doesn't work and I don't know why. Especially after spending a good half our or more trying to figure it out.

As I said above I have two scripts that work alongside eachother, and I simply named their classes the same when this script was supposed to have the class "Trigger$$anonymous$$anager." I get confused in $$anonymous$$ono Develop when it throws back errors and opens scripts in tabs and the scripts have similar names, and sometimes I don't always know what script I'm working in believe it or not, when they are really short. That may sound silly, but it's true.

Anyway thanks for your time! Again, it means a lot you answered.

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

20 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

Related Questions

namespace 'global::' already contains a definition for 'EnemyMovement' 0 Answers

how to make global labels in front and GUI.BringWindowToBack(ID); 1 Answer

tower defense turret turns right by 90degree 0 Answers

Global Variable ! 2 Answers

global chat 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