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
0
Question by nesma · Oct 18, 2014 at 04:55 PM · explosioncounterkeypresspressedexplode

make an object explode

hello , I'm creating a game where objects ( spheres) fall from the top of the screen to the bottom , when the user presses a key the object explodes. The problem i'm facing is that i have two rows of objects and when I press a key the object on both rows explodes , I only want one object to explode at a time. I've also created a counter to count the objects that have exploded when the user pressed the right key but, for some reason as soon as the object explodes the counter disappears :/ !!

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 767_2 · Oct 18, 2014 at 05:12 PM 0
Share

maybe your counter is attached to the object that get destroyed

avatar image nesma · Oct 18, 2014 at 05:14 PM 0
Share

yes it is , how can I destroy the object but count it at the same time ?

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by nesma · Oct 18, 2014 at 05:13 PM

yes it is , how can I destroy the object and count it at the same time ?

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 767_2 · Oct 18, 2014 at 05:17 PM 0
Share

you are asking a question in an answer i make a new answer

avatar image
0

Answer by 767_2 · Oct 18, 2014 at 05:18 PM

you should make counter script and attach it to a empty game object not the one that destroys

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 767_2 · Oct 18, 2014 at 05:51 PM 0
Share

you should call your counter script when an object is destroyed

avatar image nesma · Oct 18, 2014 at 06:24 PM 0
Share

I was thinking that , I wasn't sure tho ^^ thnx

avatar image nesma · Oct 18, 2014 at 06:38 PM 0
Share

I know I've asked a lot X_X is there anyway that I can have each object independently destroyed? I have two rows of objects and whenever I press the " k" button both objects are destroyed , I can't seem to figure out why ? I want when I press the " k " key once the 1st object is destroyed and then when pressed again the 2nd object is destroyed , for some reason both objects are destroyed at the same time

avatar image
0

Answer by Sethhalocat · Oct 18, 2014 at 05:22 PM

Sorry this is short but it didn't let me post before so... as I said.before even though it didn't post. Check to see if the same script is in both game objects and if the key code that you are required to hit is the Same. If it is then use a yeildwaitforseconds.(5) or something along those lines.

Comment
Add comment · Show 4 · 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 nesma · Oct 18, 2014 at 05:24 PM 0
Share

ok :D I'll give it a go thank you ^^

avatar image nesma · Oct 18, 2014 at 05:49 PM 0
Share

wait , I don't want the object to wait the amount of seconds I give it to explode , I want it to explode when i hit the right key for example if i press "k" I want the object to explode and the counter++ I'm sorry this is all new to me XD

avatar image Sethhalocat · Oct 18, 2014 at 05:54 PM 0
Share

Sorry bout that.

avatar image nesma · Oct 18, 2014 at 06:23 PM 0
Share

no biggie ^^

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

29 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to record key pressed into text file 2 Answers

Simple Explosion Script With Key Press 0 Answers

How do I chack that my explosion hit another explosive and blows up the other explosive? 0 Answers

how can I destroying a spawn object ? 1 Answer

Cleaning up explosions? 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