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 /
  • Help Room /
avatar image
0
Question by ComR · Apr 02, 2017 at 12:55 AM · scripting problemarrayobjects

Creating and destroying SELECTED objects and... sorting arrays??

Hello There,

I'm new in Unity. I was programming in C long time ago, two decades ago. Old, simple C. So, I have to learn everything from the beginning - mostly. Most problems I can find easily, but I have two problems I cannot understand... I'd be very gratefull if you would give me a tip.

1) First problem is creating and destroying objects in C# scripts. I can create objects, but... I have no idea how to destroy certain objects.... Call me stupid... I want to make Neural Network Simulation, so, I need to create objects inscripts and... later kill objects I don't need. However... I do not understand how to find which object is which and which to destroy separately... For instant, I'm creating 100 objects at once, using Instantiate, but then I want to destroy only objects I find worth killing... How can I do this? Destroy GameObject (x); // ????? how would I know which object is which? I do not want to kill all Objects, including background, lights, additionall objects - just the few ones I want to kill. I'm sorrry, I sound stupid, I guess... However... I'm stuck....

2) My second question is... well, question of old man using Basic and first C... ;) Is this now possible to sort arrays somehow, without checking every cell one by one?

My problem is: I will have array containing 100-1000 entities on a map. Every entity will have eyes. I could do this old school way, checking every array cell and calculate my needs, but I'd like to save my CPU ind only search entities x's and y's which are closest to me, or (old school) closest groups, or all entities in front of my entity.... Is there any way to do this faster than checking every x and y of every entity on the map?

Collision is a good idea, but only in one situation - collision ;). And.. is it faster than comparing every x and y from the array?

I'll be very gratefull for any tip... Most answers on the net I could find are rubbish or something completly different or... poor quality "tutorials" based on other "tutorials".

I know, probably there were many questions like this, but I cannot find answer for my problem or even idea where too look.... :(

Thank you and all the best! Bartosz

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

0 Replies

· Add your reply
  • Sort: 

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

127 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 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 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 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 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 spawn sprites in a row randomly from a single array without double-ups 0 Answers

[HELP] Setting the parent of a transform which resides in a prefab is disabled 1 Answer

Trying to track the BoxColliders of 2 Different Sets of Instantiated GameObjects 1 Answer

[Quiz Game] How to prevent Question asked twice. HELP 1 Answer

Soundarray for player is not working properly 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