- Home /
Loading Resources, are fields loaded as well?
Okay, so my question is this, and I guess I could figure it out myself with some RAM tests, but I'd love an in=depth answer. Does loading resources at runtime also load any properties and fields attached to the resource? I already know that if a resource has references to an asset, that asset is compiled into the program and the resource has access to it, of course instantiation is still necessary, but my question is this. When I load a resource, here's an example.
public class ExampleResource : ScriptableObject
{
[SerializeField]
private GameObject[] objects;
public GameObject GetAtIndex(int index)
{
return objects[index];
}
}
When I load this resource using Resources.Load(), does it also load the assets from the objects field? Regardless of file location? Or does it actually load them when I go to call to them? I assume since I have full access to the components that it is a fully loaded asset/resource at this point, no?
Additionally, if I were to load a resource that contained references to other resources in a resource folder, while it automatically load those resources as well, and then if I have a DIFFERENT reference to the same resource, would it technically already be loaded and not require additional loading? And if I were to load it again for the second resource, would it actually load it, or find itself in the pre-loaded resources and return that resource? And if it does load, does it load it into the ram ADDITIONALLY or does it push the old stack?
Your answer
Follow this Question
Related Questions
Game lags when loading AudioClip from Resources 1 Answer
Get folder names during runtime within "Resources" package? 1 Answer
Resource.Load Issue 1 Answer
What does Unity actually do when Loading Resources that already exist? 0 Answers
Do I need to manually call Resources.UnloadUnusedAssets? 0 Answers