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 Loathsome · Dec 27, 2015 at 03:56 PM · getcomponentprefabsui imagearray of gameobjectsselections

Need guidance in multi-use menu accessing prefabs

I've been struggling with this for the past four or so days. I might be going about this all wrong.

A few good examples of the type of menu I'm trying to get: Don't Starve character selection ( Don't Starve ), the menus from SimCity/City Skylines for roads, or pretty much any racer game.

The idea is to have a horizontal menu with previous/next buttons to step through the elements of an array. I've gotten the functionality of the menu down.

So far I've been trying to use Resources.LoadAll to grab test prefabs I placed in the prefabs folder (simple gameobjects made by first creating an empty gameobject and adding a UI Image component then dropping a sprite into source image). Loading all the prefabs seems to be working, however I can't seem to figure out how to access the prefabs image component to reference what the sprite is and then apply it to the menu system so there's a preview of the object ( like how in Don't Starve's menu you get a large portrait of the character).

Is my thought process correct on this, create a prefab (containing the mesh, textures, UI icons, tool tips, scripts for various stats, associated sounds, animations) and load those into an array to then cycle through as a menu.

Or do I need to load all the components into unique arrays ( UI icons array, mesh array, etc)?

Or should I make it an array of buttons that when clicked instantiate the prefab they're associated with.

Right now I'm trying to use this concept to make a constructor environment ( think the Spore creature creator). Because I don't know how many parts I will end up with, and that I would like to leave it expandable for add-ons down the road. I'm not sure if hard coding a array size is a good idea. Though it's not like I can't rewrite the size of the array over and over.

Probably bad practice of me, but I've been rewriting the same code file, deleting, adding, commenting out. Over and over so I don't have any code worth showing.

It could just boil down to I'm not using a form of GetComponent correctly. Couldn't find something like what I'm trying to do to learn from. Been in a state similar to "Who is this actor, I can picture their face, hear their voice... but I just can't think of their name!" while trying to figure this out.

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

33 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

Related Questions

Calling a function in a prefab from a function of another GameObject in C#,Calling a function in a prefab from a function in another GameObject in C# 0 Answers

Trying To Spawn a Modified Prefab with NetworkServer.Spawn doesn't work. 0 Answers

Trying to change Source Image of UI Image via Script 2 Answers

GameObject Cannot select model after breaking prefab link. 0 Answers

Prefabs not turning blue and losing connection 6 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