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
1
Question by xXTURDLEXx · Dec 16, 2012 at 12:12 AM · javascriptgameobjectdestroynoob

What is wrong with my script?

When I made this script I get an error: Assets/Scripts/destroyer.js(6,11): BCE0023: No appropriate version of 'UnityEngine.Object.Destroy' for the argument list '(System.Type)' was found.

Here is my script:

 function OnCollisionEnter(theCollision : Collision){
  
  if(theCollision.gameObject.name == "Bullet"){
   
   Destroy (GameObject);
  }
 }
Comment
Add comment · Show 10
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 clunk47 · Dec 16, 2012 at 01:49 AM 2
Share

Don't use a capital G when referenceing gameObject in Destroy. That's what OrangeLightning is saying. Just change Destroy(GameObject) to Destroy(gameObject);

 function OnCollisionEnter(theCollision : Collision)
 {
     if(theCollision.gameObject.name == "Bullet")
     {
         Destroy (gameObject);
     }
 }
avatar image xXTURDLEXx clunk47 · Dec 16, 2012 at 03:24 AM 0
Share

thanks but $$anonymous$$y script is not working, not an error but it just not working! i attached it to a cube and want it to dissapear when it touches my bullets, why is this not working?

avatar image GhandiJones clunk47 · Dec 16, 2012 at 03:28 AM 0
Share

Go watch all of these...

http://walkerboystudio.com/html/unity_course_lab_2.html

They're free vid tutorials.

avatar image clunk47 clunk47 · Dec 16, 2012 at 03:28 AM 0
Share

How fast is your bullet moving? Is the bullet a Rigidbody? If so set its collision detection to Continuous Dynamic. Otherwise you may need to look into Unity Raycast

Show more comments
avatar image clunk47 · Dec 16, 2012 at 03:24 AM 0
Share

Thank you for the vote up sir, I've done the same for you.

avatar image xXTURDLEXx · Dec 16, 2012 at 03:26 AM 0
Share
 :)

Thanks!

1 Reply

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

Answer by FLASHDENMARK · Dec 16, 2012 at 12:17 AM

Destroy(gameObject);

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 xXTURDLEXx · Dec 16, 2012 at 12:19 AM 0
Share

I still get error:(

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

12 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

Related Questions

Multiple Cars not working 1 Answer

using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers

Is it possible to destroy an object at a specific position? 2 Answers

Destroy on Collision? 1 Answer

Changing of Variables (Big Noob Question) 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