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 Sorade · Mar 22, 2017 at 07:15 AM · scripting problemnamespace

Removing Namespaces from default scripts ... is it safe ?

Hi all,

I am not an expert in scripting and the Unity structure is still a bit obscure to me. I am currently trying to check for events I created in my game from inside the FirstPersonController script that comes with Unity.

I think that due to the class being part of its own namespace it can't detect events which I created in my other scripts.

Is it safe to remove that namespace so that I can access my events in the FirstPersonController class ?

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
1

Answer by beStrange · Mar 28, 2017 at 01:23 PM

The main use for namespace is to prevent naming conflicts and,as already mentioned, to organise things. Removing namespaces from a tightly packed system, like it is the case for Unity, will most likely result in a ton of issues across the board.

TL;DR: No it's not safe to remove namespaces from default scripts.

In your case, there are probably some underlying issues in the way you trigger and subscribe to your own events. Creating and using a custom event system might be a little to much for you at the moment and you might be better of using the callbacks that are provided by Unity.

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 NicholasSheehan · Mar 23, 2017 at 02:44 PM

Yes, Namespaces are used to organise code.

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 Sorade · Mar 27, 2017 at 02:05 PM 0
Share

I had a look around and it looks like the FirstPersonController namespace is required in other scripts from the standard assets so I think if I remove the namespace from it those scripts won't work

avatar image dvandamme Sorade · Mar 28, 2017 at 10:30 AM 1
Share

do not remove namespace's from scripts that come with unity unless you actually know exactly what you're doing. the reason for that is that every script that references the suddenly removed namespace item will be lost, and you'll have to go through every one, and redirect them.

if you want to use those existing scripts, you add a

 using whatever.TheName.Space.Is; 

reference at the top of your script, and then you can use it.

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

6 People are following this question.

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

Related Questions

Platform dependent flags required in Using/Namespace definition? 1 Answer

How to import project 1 to another project , with same name of script with unique namespaces and different root folder? 1 Answer

The type or namespace name could not be found. Are you missing a using directive or an assembly reference? 4 Answers

Error CS0234: The type or namespace name `IActiveBuildTargetChanged' does not exist in the namespace `UnityEditor.Build'. Even after moving Editor folder. 4 Answers

Which is the namespace of the Joystick pack?,Which is the nameSpace of Joystick pack? 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