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 JinHyuckOh · Jul 23, 2019 at 09:23 PM · buildmemoryresources

When are resources outside the resource folder in memory?

I used Google Translator.....Sorry :)

I know that the resources in the resource folder are all up in memory when the client runs.

If so, are the resources outside the resource folder also packaged together in memory?

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

Answer by Cornelis-de-Jager · Jul 23, 2019 at 09:26 PM

So its not really to do with when its ran, but rather when you build the project.

All files in resources will be loaded and used. Where as only the used files, gameobjects and prefabs in the assets folder will be loaded. If it is not used anywhere in your game it will not be loaded.

Comment
Add comment · 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
0

Answer by Bunny83 · Jul 24, 2019 at 12:30 AM

Assets have two main anchors which are responsible if an asset is actually included in a build and when it's loaded. Those two anchors are:

  • The Resources folders (note you can have multiple folders. Any subfolder named Resources will also work)

  • The included scene files.


The Resources folder can be seen like static variables. Assets in those folders are always included in a build and always loaded at the game start.


Any other asset that is not in a resources folder will only be included if it belongs directly or indirectly to a scene that is included in the build settings. All the assets will essentially form a dependency chain and the top element is a scene. So for example a scene could contain a gameobject with a MeshFilter and a MeshRenderer component. The MeshFilter has a serialized reference to a Mesh asset. So that mesh will be loaded with the scene when the scene is loaded. Likewise the MeshRenderer will have a Material reference so that material will be loaded as well. The chain goes on. The Material asset will have a reference to a certain Shader asset and probably to one or multiple Texture2D assets. All those will be loaded with the scene.


There might be chains you haven't considered yet. For example Prefab assets in the project might also have references to other assets. Another scenario:

The scene has a gameobject with a monobehaviour script. That script might have a public serialized field which references a prefab. That means the prefab is loaded with the scene. Keep in mind we talk about the prefab asset and not potential instances which might be inside the scene. The prefab can in turn have a different script attached which might reference other assets like a texture for example. All those assets need to be loaded since the script in the scene could use the prefab reference, access the script on the prefab and access the referenced texture.


If a certain asset is not directly or indirectly referenced by "scene 0" it will not be loaded when scene 0 is loaded. However such an asset might be used in "scene 3" and therefore has been included in the build but isn't loaded in the beginning. Only when scene 3 is loaded everything referenced from scene 3 will be loaded.


All those "used" / referenced assets are usually packed with the scene that actually use those assets. To reduce the initial startup time you want to avoid unnecessary references to assets in the first scene. That's why larger games often have an almost empty loading scene which might just show some initial information, a loading bar or a simple start menu.

Comment
Add comment · 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

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

121 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 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 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 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

Distribute terrain in zones 3 Answers

Prefabs are instantiated in editor but not in executable 2 Answers

Best way to handle 100+ sound files 0 Answers

Add python script to build 1 Answer

Resources.UnloadAsset - How To Use on Prefab 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