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 Hirnfroster · Dec 13, 2016 at 02:10 AM · buildimageresourcesfolder

Loading image for inventory from calculated path

Hey guys :D

I was working on my inventory system (Everything worked while developing) and everything was fine until I build it. The Sprites for the items were not loaded and this caused quite a lot of errors. My attempt for this was the following design:

Each item was in a certain folder in my "database" (Not a real one, but more like a hierarchy of folders). Each folder than contains:

  1. A .json file with attributes

  2. Various .json files for translations

  3. A model

  4. A sprite for the inventory

This "database" was in the Resources folder first. but when I built the game, It couldn't be loaded. I've then read on Unity that using that Resources folder isn't a good idea. So I moved it to another folder. But since I can't use Resources.Load anymore I have a problem.

Basically I just need a way to dynamically import the required image to the inventory-object.

P.S.: I had the idea that I would structure the folder hierarchy like the ID. For example item with ID 00-00-01 would be in ItemDatabase/00/00/01 and then I could find all my stuff, that I mentioned above. I really really like this concept, because I can easily add more items just with a single folder and I don't want to give it up, unless it's total [insertBadWordHere]

P.P.S.: I assume that the same thing happens with the prefabs for all items. So I probably need a clever solution for this too.

Thank you guys in advance!

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 getyour411 · Dec 13, 2016 at 02:14 AM 0
Share

Could you elaborate?

"...This "database" was in the Resources folder first. but when I built the game, It couldn't be loaded. I've then read on Unity that using that Resources folder isn't a good idea..."

avatar image Hirnfroster · Dec 13, 2016 at 12:06 PM 0
Share

I had a folder structure for the items (This was my database). This database was in my Resources folder. It looked basically like this: Assets/Resources/ItemDatabase/Items... Everything worked while I was working in Unity. I had functions to load the appropriate Sprite and Prefab into the scene (With Resources.Load()). But after I built the game, the Resources folder changed quite a lot. I no longer had these item paths and the functions for loading sprite and model said that the required files couldn't be found ($$anonymous$$y own error message. It is displayed if I try to load something that doesn't exist). While I was searching for answers, I found this article https://unity3d.com/de/learn/tutorials/topics/best-practices/resources-folder and it clearly says that it shouldn't be used in this case...

I hope you get the idea :)

avatar image getyour411 Hirnfroster · Dec 14, 2016 at 05:48 AM 0
Share

Interesting, thanks for the link.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Resource folder doesn't build. Why is it empty? 1 Answer

Distribute terrain in zones 3 Answers

How To Refresh Resources Folder in Build? 1 Answer

Subfolders with Resources.Load not working 2 Answers

Mouse cursor is giant in Mac builds. 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