【Optimizers】- Easy to use and functional components to optimize any other components!

Animator component is not supported for built-in component types, but there is implementation package for it: https://drive.google.com/file/d/1Ujw5GDlDdnpDbOt-uovrGsGj84mW1P8k/view?usp=drive_link

But check the imported .cs file which includes readme. You need to add one extra line in the ‘OptimizerLODInstanceGenerator.cs’ file.
(please update and import the newest update on the asset store)
This implementation is not for Essential Optimizer, but for Optimizer 2.

Also if you use animator, you may not like to disable it when it gets out of sight (optimizer’s enable/disable will probably cause animator restart) then you need to change the “Hidden” LOD setting : don’t disable animator.
Use Animator component culling mode for out of sight optimization (unity’s internal culling is not restarting animator).

Laggy inspector window when you add so many objects is unity editor gui performance problem.
When MonoBehaviour is containing very big list of items with many fields, it gets laggy even if you don’t display this list in any visible way. Optimizers should be used on single objects with many components or on not too big groups of objects tho. Using single optimizers component on the whole game level is wrong use of this plugin.

Any thoughts on this? Thanks.

First of all your code still works on a 2020.3.33f1 build! I have about 3000 buildings/etc spawning. You know we always want more!

How does this work with Addressables and generator scripts like Dungeon Architect for Unity**?**
Here is a link to his stuff. You will be redirected shortly

I am thinking I should just do a preloader for the scene and then run your code next. Or do you have something that plays nice with Addressables and generators planned? I have not tried this yet but I am expecting this to not work as the object has to be in the scene first for the optimizer to optimize it right now. If there is another way then let me know. I am using a generator to create the city at run time and then I turn on the optimizer. Addressable can take some time to load so that may not be doable.

I am thinking that putting the object in a placeholder game object and then loading the addressable from that should work. The addressable will already have the basic optimizer on it. I have tested that just turning the object off and then on works sometimes.

Hey if you have a workflow that already addresses this then let me know. If this is a planned update or coming feature then SWEET! I see you have something that works with dots also. Is this what I should be looking at even though this is not a DOTS style game design?

Thanks again and your stuff rocks.

1 Like

Hello, do you support occlusion culling of dynamic concave polygon objects in the scene?

Sorry for late reply. Detection shape radius can be different per object, it will make no difference in performance.
You need to keep the same LOD count, the same LOD distance ranges, and same max distance, to keep them inside one culling container, for best performance.
myOptimizer.TryAutoComputeDetectionShape(scaleMultiplier); method sometimes can be helpful for auto-computing detection radius.

The Progressive Culling feature of Optimizers (gives similar result like Occlusion Culling but without need to bake)
can detect cullling on any type of collider that unity raycast is able to detect.
It works on convex/non convex colliders, but I am not fully sure what you mean by ‘concave polygon objects’.
Progressive Culling is preparing detection collider on start, so it may require custom collider mesh reference assign, if it’s some kind of dynamic-procedural collider.

Thank you!
I am not sure if I fully understand, but you say you need an optimizer component, which would load/unload the assets if they’re far/around the gameplay area, in order to make memory usage lowest as possible?
Optimizers will not be good for such usage.
Proper load/unload system will require different logic to handle this stuff.
I have no plans to do such plugin yet.

Why WatchUpdate take so much CPU performance?

I often get an error when I switch scenes

If there are many objects to update, it can take longer for watches to update.
But 1ms seems to be a bit too long.
Setting optimization mode to “Static” on objects which are not moving, will improve it.

Watches are adapting to the game performance, if game frame takes longer to render, watches are delaying update to cost less. Each watcher is handling objects at different distances to the camera, prioritizing them.
In the Optimizers Manager you can expand “Dynamic Optimizing Setup” to adjust world scale to organize objects in more accurate watches. (If world scale is too big, all object may be put inside watcher of highest priority which costs more!)

I can’t reproduce it on my side. I will do tests in the next days.

When I disable gameobject,and set FadeDuration > 0,

why the optimizer2 will auto enabled my gameobject?

and I don;t use DeactivateObject.

========================================================================
I found this

Hello, I can’t remember why it’s here, I guess some old feature required it.
I think you can safely remove this line, just keep in mind than activate/deactivate game object tends to trigger garbage collector resulting in performance spikes if a lot of deactivation is going on (like camera view culling on/off when rotating view)

Because my TOD System need to close point light in a day,But I found my setpass is still very high,So when I check the optimize found this problem, now I remove this line everything is fine

Hi, I just imported Optimizers and my project got error. How to fix?
Assets\FImpossible Creations\Shared Tools\Editor Tools\FEditor_Handles.cs(39,19): error CS0117: ‘Event’ does not contain a definition for ‘current’

I use Unity 2022.3.10f1

Update: It because I have a script called “Event” too. Fixed.

When you import optimizers package you get message about upading unity API methods for this one script file.
You need to hit “yes” to avoid this error.
9570643--1354246--upload_2024-1-9_13-22-20.png

Hello!
I’m trying to change the visibility range of objects on the fly during the game in the settings, I do it like this:

EssentialOptimizer[] _essentialOptimizer = FindObjectsOfType<EssentialOptimizer>(true);
foreach (EssentialOptimizer source in _essentialOptimizer) {
     if (source != null) source.MaxDistance = 50f;
}

In prefabs, although the MaxDistance parameter changes, the optimizer does not seem to apply these values on the fly. I need to restart the game for this value to work.
Perhaps there is some method that updates these values in the script or something that I missed?

Hello, unfortunately, you can’t change distance range on the fly.
Optimizers plugin is using Culling Groups API which requires to define static distance ranges when initializing.
This API works best if there are multiple objects with very same distance ranges (it’s generating groups of objects to optimize and each group is defined by the distance ranges), so changing it is not good for this system.

@FimpossibleCreations Hello Optimizers Team,

I have been using the Optimizers plugin for some time now and have found it to be an invaluable asset in streamlining performance within Unity. Its functionality and ease of use are commendable. However, I would like to highlight a couple of issues that I’ve encountered, which I believe could improve the plugin’s robustness if addressed.

  • Negative Scale Handling
    There appears to be a peculiar interaction with objects set to a negative scale: both the Max Distance and Detection Radius settings in Optimizers behave unexpectedly. Increasing the Detection Radius paradoxically reduces the Gizmos’ drawn range. Moreover, negatively scaled objects remain in a “Culled” state during runtime. Given the commonality of using negative scales in scene setup, it might be beneficial to investigate how scale values are computed, perhaps considering the absolute value of the scale to rectify this discrepancy.

  • Particle System Handling
    I’ve also encountered issues with the Optimizer’s management of particle systems, specifically when a component of the particle system is removed rather than merely disabled. The Optimizer attempts to access these removed components during serialization, leading to errors. Ensuring the Optimizer verifies the presence of a component before accessing it could prevent these errors and enhance stability.

Rectifying these points would undoubtedly elevate the user experience and utility of the Optimizers plugin. Thank you for taking the time to consider this feedback, and I look forward to any developments on these issues.

hello I use an asset called voxel play which allows you to generate voxel terrains a bit like those of Minecraft, each voxel is a scriptable object, I would like to know if I can use your assets to optimize the chunks far away and improve the performance especially for Mobile devices while maintaining a large viewing distance, I would like to use your “lod” system on all distant chunks

Hey mr Fimpossible. I have the optimisers tool and it works great with particle systems. I’m just trying to figure out what it actually does to a skinned mesh renderer and whether it would be more efficient for me to program something that totally disables the object. Does it totally cull the animations playing? Thanks,