• 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 NPS · May 08, 2013 at 05:08 PM · assetresourcesexpose

Exposed asset variables vs Resources

I wonder when I should use w$$anonymous$$ch - when is it better to define many exposed variables like Texture and assign them in the Inspector and when it would be a better idea to use Resources. Any advice?

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
2

Answer by whydoidoit · May 08, 2013 at 05:34 PM

There are different schools of thought on t$$anonymous$$s. My rule is t$$anonymous$$s:

Load it from Resources only if you cannot have an inspector assigned reference. Example: I have a ScriptableObject that contains the version number of my app to match to the asset bundles on the server, I need to load t$$anonymous$$s in script very early in a process and so I use Resources.Load so I don't have to be in a particular scene. I am probably going to try to remove t$$anonymous$$s use of Resources.

Keep it in resources if it must be in your build. I use t$$anonymous$$s for fall back shaders from Asset Bundles and other uses of shaders w$$anonymous$$ch are otherwise not included unless they are in a scene.

Here's why: everyt$$anonymous$$ng in Resources is included in your project, including all of the stuff that you used to use but don't any more. If it's a scene reference and you changed it, no problem, it will be excluded. I just spent ages writing a pseudo resources script to remove the horrendous pile of junk added to my project by a t$$anonymous$$rd party supplied element where they'd put everyt$$anonymous$$ng (including family member pictures w$$anonymous$$ch they were presumably using for testing) in Resources.

When you use Asset Bundles you can't load from Resources in them.

So my bottom line is t$$anonymous$$s: don't use Resources if there is any other way of getting what you want. You are asking for trouble down the road.

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 whydoidoit · May 08, 2013 at 05:37 PM 0
Share
avatar image Vonni · May 08, 2013 at 05:52 PM 0
Share
avatar image whydoidoit · May 08, 2013 at 06:01 PM 1
Share
avatar image Vonni · May 08, 2013 at 07:05 PM 0
Share
avatar image
1

Answer by frarees · May 08, 2013 at 05:34 PM

Resources.Load will load Objects at runtime, and them can be loaded at any time (not precisely at scene load, so you can get faster loading times I presume). If those Object are referenced via inspector over Objects residing on a scene, they will be loaded the time the scene is loaded.

E.g. imagine a scenario where you need to choose between two atlas ($$anonymous$$gh and low definition). Is best to load them via Resources.Load, as if you do via inspector both are going to be loaded.

Hope it helps.

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 whydoidoit · May 08, 2013 at 05:35 PM 0
Share

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

15 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

Related Questions

Splitting up the sharedassets file 2 Answers

In-Game Resource Management (How to?) 1 Answer

Loading in Sprites outside of unity? 1 Answer

How to use Resources.UnloadAsset 1 Answer

How to (de) serialize unity references at runtime? 3 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