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
1
Question by magnusm · Oct 05, 2013 at 01:44 PM · javascriptgameobjectassetfindsearch

Finding Assets/Prefabs That Are Not In The Scene

Hey,

I have a list of modular GameObjects that I want the user to user to be able to select from and various scripts to spawn. Currently I have it set up so every GameObject is assigned to a variable in the inspector. This results is a large and painful list of variables under the script.

Is there is a way of searching through all your assets for a specific tag and then searching through that list/array for something even more specific, like the Name of the object?

This would save me a lot of time, and make everything more future proof. There must be some sort of trick for searching though a group of assets that are not in the scene, rather than assigning them all individually in the inspector.

Also answers in Javascript would be preferred :) Many thanks,

Magnus

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 whydoidoit · Oct 05, 2013 at 01:46 PM

Well no not really :( The only other way is to include them in a Resources folder and then get them from there. However, there is no way of enumerating the contents of a Resources folder.

What I do is create a script that acts as scene resources which I can search on by name. This is basically a big array and I assign all of the relevant prefabs to it - which is at least just a big drag and drop operation rather than finding everything and assigning it individually.

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 magnusm · Oct 05, 2013 at 01:58 PM 0
Share

Ahh lame, well it's nice to know a definitive answer.

Yeah, that is a good idea. I was thinking of something similar but was reluctant to continue assigning things in the inspector. The reason is weird actually, I was using your Save Game $$anonymous$$anager asset (which is sweet btw) and I messed up and somehow endup with ALL my previously assigned variables being unassigned, which was a massive ball-ache to reassign them all. I just don't want that to happen again as I still cant get that thing the work propperly :P

avatar image whydoidoit · Oct 05, 2013 at 01:59 PM 0
Share

Well quite - it can be a real pain when things like that happen (sorry if it was my fault!)

It's actually useful to have things assigned per scene if you ever end up using Asset Bundles as Resources folders just bloat your distributable.

avatar image magnusm · Oct 05, 2013 at 02:13 PM 0
Share

Nah dont worry, definately my fault.

Is it cool if I ask you some questions about Unity Serializer at some point in the future, when I get around to trying to implement it again?

I was trying to make simple Save/Load and Undo/Redo feature for my ship builder scene. Just I tried for days to get it to be stable enough to use, but couldn't for some reason :P

avatar image whydoidoit · Oct 05, 2013 at 02:25 PM 0
Share

Sure email me. Contact details on the site.

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

16 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

Related Questions

"GameObject.Find();" not working 2 Answers

Find Transform in the scene 2 Answers

Simple In game search field 2 Answers

Separate objects from GameObject[] group 0 Answers

Find Keyword in a Searched GameObject (JS) 2 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