Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 saberboy117 · Jul 14, 2011 at 01:18 AM · namespace

error: namespace already contains definition

I keep getting a report saying Assets/Scripts/Ships/MissileLancher.js(9,6): BCE0132: The namespace '' already contains a definition for 'guntype'.

it has only one definition help?

 var reloadtime : float;
 var shot : GameObject;
 var numshots : int;
 var au : Object;
 private var Target : GameObject;
 
 enum guntype{
 singlefire,
 rapidfire,
 }
 
 
 function ChangeTarget(t : GameObject){
 Target = t;
 }
 
 
 
 var gunType : guntype;
 
 private var loaded : boolean = true;
 private var fireing : boolean = false;
 private var t : Transform;
 
 function Start(){
 t = transform;
 au = audio;
 }
 
 
 
 function FireCheck(){
 switch(gunType){
 case guntype.singlefire:
     if (loaded){Fire();}
     break;
 case guntype.rapidfire:
     if (loaded){Fire();}
     break;
 }
 }
 
 function Fire(){
 var s : GameObject;
 switch(gunType){
 case guntype.singlefire:
     s=Instantiate(shot,t.position,t.rotation);
     s.SendMessage("ChangeTarget",Target,SendMessageOptions.DontRequireReceiver);
     au.Play();
     loaded = false;
     yield WaitForSeconds(reloadtime);
     loaded = true;
     break;
 case guntype.rapidfire:
     for (i=1;i < numshots; i++){
     s=Instantiate(shot,t.position,t.rotation);
     au.Play();
     yield WaitForSeconds(0.15);
     }
     loaded = false;
     yield WaitForSeconds(reloadtime);
     loaded = true;
     break;
 }
 }


thanks

Comment
Add comment · Show 2
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 Dr.Creepster · Nov 08, 2015 at 06:37 AM 0
Share

I have the same error but for the first person camera. Help?

avatar image rutter Dr.Creepster · Nov 08, 2015 at 06:38 AM 0
Share

Help with what? As aldonaletto said, this error indicates a duplicated script name somewhere in your project. You'll have to fix that.

2 Replies

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

Answer by aldonaletto · Jul 14, 2011 at 01:44 AM

I placed this script in my project, and had no errors. It seems you have another script (maybe an old version of this one) with guntype defined elsewhere in your project, and it's causing the error. Both scripts probably are in the same folder - I tried this, and only had errors when both scripts were compiled together.

Comment
Add comment · Show 3 · 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 saberboy117 · Jul 14, 2011 at 05:21 PM 0
Share

oh, I have a laser cannon using guntype in the same folder mabey thats it lol

avatar image aldonaletto · Jul 14, 2011 at 08:13 PM 0
Share

Aha! I knew it! (I had the same problem once...) Well, if this solved your problem, please click the "check" button below the voting thumbs (in the answer), so the question is marked as solved and may help others with a similar problem.

avatar image Bizbud · Jun 12, 2016 at 03:19 PM 0
Share

well I'm coding Stats for an RPG, so far I have "intellect", "charisma" Strength" etc. Anyways I have set a base class so my other classes like a Rogue or Hunter can inherit from it. $$anonymous$$y base class has: public int Sta$$anonymous$$a { get{return Sta$$anonymous$$a;} set{Sta$$anonymous$$a = value;} }

And my Rogue class has: Sta$$anonymous$$a = 20; I don't see why this is a problem because "value" is a variable right, and in my Rogue class sets the value for that variable. Please help.

avatar image
0

Answer by ahmedaniss · Jun 14, 2021 at 10:22 PM

Problem Fixed here : https://youtu.be/28n9q8GG-gg

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

6 People are following this question.

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

Related Questions

Necessary to remove unused scripts from imported packages for deployment? 1 Answer

FPS Gun Script Definition error 1 Answer

namespace support in unity 1 Answer

Error the type or namespace name 1 Answer

Script in Scripts folder can't find namespace of file in Plugin folder 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