GetCachedComponent

momomo

New member
Hello,
Is the "GetCachedComponent" series useful even if the processing is not done every frame?

Also, is there any data that shows the performance benefits of the process even if it is done every frame?
 
The memory allocation is done in the process.
I don't remember if the original GetComponent does memory allocation or not, but seeing the new keyword is something that console developers need to be aware of.
Also, the static field in GameObjectExtension doesn't look like it's being freed.
Shouldn't the references in the scene be freed when the scene is switched?
I haven't tried it, but when you transition from sceneA -> sceneB -> sceneA, does this dictionary continue to store elements forever?
I wanted to know why you implemented this because I don't see the need to go to the trouble of using a complicated feature, especially if it doesn't affect performance...
 
I don't remember if the original GetComponent does memory allocation or not, but seeing the new keyword is something that console developers need to be aware of.
GetComponent doesn't allocate memory, but it does take a long time to search. GetCachedComponent uses memory for a performance gain.

Shouldn't the references in the scene be freed when the scene is switched?
You can call DomainReset to reset the memory. References can be kept between scenes.

I wanted to know why you implemented this because I don't see the need to go to the trouble of using a complicated feature, especially if it doesn't affect performance...
It does improve performance.
 
I didn't know that references to game objects originally in a scene could be matched by the first key generated, even if the scene switches back to the original. It's amazing.
However, I believe that references to dynamically generated game objects in a scene will continue to pile up unless they are released.
You recommended to DomainReset, but this seemed unfriendly as it is not publicly available.
I know this because I've seen the source. I think it would be nice to have Clear as a public method.
Anyway, I understand. Thank you.
 
Top