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 sentar · Feb 28, 2017 at 07:40 AM · listgameobjectsdropdownplacementbuildings

Add game building items to dropdown list?

I am still a beginner with 3d Unity, and have accomplished a main menu, character selection scene, choose faction scene, and have made my main map. I got several different types of characters, and building structures etc.

What I am trying to learn: How to get a list of my building structures for the player to select houses, walls, tables etc. to put that item into the game wherever the player may choose.

(My purpose in what I am aiming for) For most games a player will press "B" to open up a menu that the player can select "Buildings", and is presented with a list of building types with pictures of each building. The player then can select a building of choice, and it is put into the game where the player can choose where to place the building at.

I am wanting to do this through UI canvas > dropdown list (called building) > select building (small, medium, large) > New sub list pops up with the pictures of buildings to choose from for that category. Then the player can select the building, and place it wherever they want in there game.

Where I am stuck at: I am stuck on how to make a building type show up in the list with a picture of it, and place it in the scene.

I have spent a couple of hours trying to look up Character Object List, but to no avail.

What training, videos (that I have missed) do I need to look at to better understand how to do this process?

What I have so far: In the main game I have the Canvas > Dropdown list name "Buildings" > option1 small > option2 medium > option3 large.

Another canvas for each option (small, medium, large) to populate the list of the specific buildings.

Thank you for your time and effort have a great day!

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

1 Reply

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

Answer by sentar · Mar 01, 2017 at 07:24 AM

Update

With having complication with Dropdown list, I decided to use the standard Button, and create another canvas for small, medium, large building selection, after selecting small, it opens up another canvas that should have the list of smaller buildings inside it. I just have to figure out how to make the buildings show up in that canvas (if it is possible).

The structure:

1st Canvas is Button "Building" > 2nd Canvas is Button "Small" is selected by player > 3rd Canvas, (list of buildings to populate for player to choose from).

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 sentar · Mar 02, 2017 at 06:29 AM 0
Share

Another Update on my current status:

I was able to understand that a prefab is the building object, and I got the building to come into the scene with adding rigidbody to it and using this code to make it appear. However, I am still learning how to add the prefab into the list on the 3rd Canvas.

Current Script: public GameObject smalllist; GameObject smalllistclone;

 // Use this for initialization
 void Update () {
     if (Input.Get$$anonymous$$eyDown("3"))
     {
         smalllistclone = Instantiate(smalllist, transform.position, Quaternion.identity) as GameObject;
     }
     if (Input.Get$$anonymous$$eyDown("4"))
     {
         Destroy(smalllistclone);
     }
 }

So now ins$$anonymous$$d of, Input.Get$$anonymous$$eyDown I will continue my pursuit in researching how to make it recognize when I click on "small building" button I created in the 3rd canvas to appear like the script with pressing "3".

Then I will attempt to learn how to do the rotation of the prefab, and allowing player to place the prefab wherever desired.

avatar image sentar · Mar 06, 2017 at 03:02 AM 0
Share

I changed the if statement to:

public void InsertPress() { if (Input.GetButtonDown("Barrell1")) { smalllistclone = Instantiate(smalllist, transform.position, Quaternion.identity) as GameObject; } } public void UndoPress() { if (Input.GetButtonDown("Undosmallbuilding")) { Destroy(smalllistclone); }

I added this into the button, and got the function to accept the Instert/Undo; however, now I cannot see it appear in the game. I have an instantiator on my character, now will try to learn how to make that instantiator work.

avatar image sentar · Mar 06, 2017 at 05:02 AM 0
Share

all I had to go is remove the if statement but leave my internal code, and now the button works with putting a building into the game!!

Now I just have to learn how to add a 2d image of the prefab with the button beside it.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

On clicking a gameobect I want a dropdown menu to appear beside the gameobejct and then on selection one of the options in dropdown I need 2 text boxes to appear. Thanks 0 Answers

How to make ray hitting only game objects with tag from list 2 Answers

Removing GameObjects from list (with List.Remove()) doesn't seem to be removing them 2 Answers

Question about variabl lists 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