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 ZachAttack9280 · Sep 23, 2017 at 10:01 PM · gameobjecttransformmoveclickup

GameObject automatically moves up when upgrade is purchased.

Hello, I have a list of 4 gameobjects. They are all upgrades, so for when I click the first one, the gameobject is destroyed, great, but I want the rest of the three upgrades to automatically move up after I have bought an upgrade. Kind of like the upgrade system in Adventure Capitalists. Any ideas? Thanks, nightdev.

Comment
Add comment · Show 3
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 kaplica · Sep 24, 2017 at 07:49 AM 0
Share

Hi what gui system are you using and what layout ?

avatar image ZachAttack9280 kaplica · Oct 01, 2017 at 12:51 AM 0
Share

Like where are the objects are set in?

avatar image ZachAttack9280 · Oct 09, 2017 at 03:38 PM 0
Share

Still need an answer as soon as possible. Please and thanks.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Whitecold · Sep 24, 2017 at 08:10 AM

If you are using some layout group, it should automatically readjust if you delete some items

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 ZachAttack9280 · Sep 26, 2017 at 05:20 PM 0
Share

No, I am talking about while in game. The object would disappear and the rest would move up automatically let's say when that object is pressed. If that makes sense...

avatar image
0

Answer by lilscarecrow · Oct 09, 2017 at 04:17 PM

You could use a queue to achieve this. Each index in the queue could tell what the objects position should be and you could dequeue an entry when its clicked.

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 ZachAttack9280 · Oct 09, 2017 at 05:03 PM 0
Share

Would there be a specific system used to make this queue? Like a list? I understand what you mean but doesn't make sense on how I would achieve this.

avatar image lilscarecrow ZachAttack9280 · Oct 09, 2017 at 05:36 PM 0
Share

There's a built in queue you could use that basically serves as a list with the options to enqueue/dequeue/peek/etc. So you could make a queue with the type of your gameObjects and insert them in the order you want with the positions desired at each index. So you could iterate the queue and set the gameObject at each index to achieve this (maybe only update each objects position when you enqueue/dequeue). So the way I would approach would be like this: 1. At the start build your queue up (if this information is known at startup) 2. Have a function that will update the position of the gameObjects within the queue at each index 3. Have a function that gets called when you want to remove the item from the queue and dequeue it (ex. click on the item -> call the dequeue function) 4. When you dequeue, make sure to call your function to update all positions again

One problem with this approach is if you want to remove items that are NOT next in line, like the 3rd index. In that case you could do something similar but would want to use a linked list or something else rather than a queue.

avatar image ZachAttack9280 lilscarecrow · Oct 09, 2017 at 09:39 PM 0
Share

where would this built in queue be located?

Show more comments

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

114 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

Related Questions

Problem dragging, scaling, moving objects in #scene view with mouse 0 Answers

Locating Position of Object not Working? 2 Answers

Relative Rotation of GameObject 3 Answers

How to assign a transform object to Prefab ? 3 Answers

Write a C# script to record GameObject rotation? 4 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