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
0
Question by WhiskeyJack · May 12, 2011 at 12:40 PM · resourcesidentifyloadall

How to identify/get the file name of resources loaded with Resources.LoadAll

I would like to use Resources.LoadAll to load a bunch of textures. However, how can I identify each loaded resource? I would like to know the filename of each resource, so I can put them in a Dictionary and use the filename as a key to access the textures. Is this possible? Or is there a another/better solution?

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

2 Replies

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

Answer by WhiskeyJack · May 12, 2011 at 01:06 PM

Never mind, you can just do object.name to get the filename (minus extension). Typically a case of looking to hard.

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 DaveA · May 12, 2011 at 03:12 PM 0
Share

It would be nice to get the extension, so you can tell the difference between a jpg and png and so forth though.

avatar image WhiskeyJack · May 15, 2011 at 08:36 PM 0
Share

I definitely agree with you on that one.

avatar image BerggreenDK · Jul 18, 2011 at 11:23 PM 0
Share

just make your own na$$anonymous$$g convention then, either in the end or at the start of the file or place them in seperate folders.

avatar image Lou-adrien Fabre · Jun 10, 2014 at 11:29 AM 0
Share

In the case of shaders, obj.name will not be accurate, for example if you have a shader named : "Unlit - Transparent Colored" the name of the object will be transformed in "Unlit/Transparent Colored". I have been searching for some functionnalities of AssetDatabase to achieve the exact desired name result but couldnt find it yet.

avatar image
0

Answer by Lou-adrien Fabre · Jun 10, 2014 at 12:53 PM

Read my previous comment, but so far the only really reliable way to find the file name (and not resource name) is the following : Path.GetFileNameWithoutExtension(AssetDatabase.GetAssetPath(obj));

Where obj is the resource object.

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 arutyunef · Sep 15, 2019 at 01:29 PM 0
Share

Sure but u won't be able to use AssetDatabase in build

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

Trying to use Resources.LoadAll to change sprite sheets during runtime 0 Answers

Resources.LoadAll cant locate Prefabs directory 1 Answer

Loading textures runtime and assign to multiple button 1 Answer

LoadAll order issue 3 Answers

Have some strange problem with Resources.Load 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