Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

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

Discussion in 'Assets and Asset Store' started by FimpossibleCreations, Jan 28, 2020.

  1. EpicMcDude

    EpicMcDude

    Joined:
    Apr 15, 2013
    Posts:
    86
    Hello,

    Just imported this asset and am already getting these errors:
    upload_2022-6-10_21-13-39.png

    What can I do?

    Thank you
     
  2. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    494
    Hi, what version of the Unity Engine you use?
    I can't reproduce the error with versions like 2018.4 up to 2022.1.0b15
     
  3. EpicMcDude

    EpicMcDude

    Joined:
    Apr 15, 2013
    Posts:
    86
    Hi, I'm on the LTS 2020.3.26. Would it happen to have conflict with some other asset? I bought your Seamless Texture Generator last week, and imported this asset onto another folder, should they both go into the same "Fimpossible" folder?
    Or would there be a conflict with some other asset that's creating this error?
    Sorry, I'm not a programmer, wouldn't know how to fix it or what's causing it.

    Thank you
     
  4. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    505
    Hi,

    Pressing ALT + F4 on a build causes this error being sent multiple times while using the component on a lot of objects.

    [19:47:01] IndexOutOfRangeException: Index was outside the bounds of the array. FIMSpace.FOptimizing.Optimizers_CullingContainer.MoveStackOptimizerToFreeSlot () (at <4ea4fc6dcb5e49608e88cbc8061b1532>:0) FIMSpace.FOptimizing.Optimizers_CullingContainer.RemoveOptimizer (FIMSpace.FOptimizing.Optimizer_Base optimizer) (at <4ea4fc6dcb5e49608e88cbc8061b1532>:0) FIMSpace.FOptimizing.Optimizer_Base.CleanCullingGroup () (at <4ea4fc6dcb5e49608e88cbc8061b1532>:0) FIMSpace.FOptimizing.Optimizer_Base.OnDestroy () (at <4ea4fc6dcb5e49608e88cbc8061b1532>:0)
     
  5. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    494
    Please make sure you have both plugins updated to the newest version.
    You can try removing the Fimpossible Creations directory and import plugins again, I think there will be some "API update" unity dialog, maybe you skipped it?
    I just checked it on the same unity version as yours and there are no conflicts.


    thanks for report, sounds like manager being destroyed before optimizers objects, I will implement some handler for this exception for the next update.
     
    skinwalker likes this.
  6. EpicMcDude

    EpicMcDude

    Joined:
    Apr 15, 2013
    Posts:
    86
    Hmm, I just deleted both assets, restarted Unity, reimported the Optimizers asset and still the same issue with those 3 errors. I didn't get any pop-up to update the API.
    Is there a way to do it manually via project settings or something?

    Thank you
     
  7. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    494
    Are you using some assembly definitions?
    The error is related to core elements of the unity editor so it's really weird, maybe try re-installing unity? Or create other new project and import the plugins to check if the errors are here too, unity sometimes is messing up project files.
     
    Last edited: Jun 22, 2022
  8. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    734
    Hi,
    I'm thinking of different solution to render vegetation on some small places. I'm making a huge desert, and i would like to know if you would think smart to spawn grass and veg as gameobjects and optimize with your tool that i already own.
    if so, what would be your settings and advice for vegetation (static or not,...cull,....) i'm not to familiar with those things and i want to avoy VSpro.
    thanks in advance
    takeshi
     
  9. cowj

    cowj

    Joined:
    Mar 10, 2019
    Posts:
    17
    i have ik and some sensor on prefab,if i want disable ik no disable sensor if visable culling, disable all if distance culling,how to set up? thanks
    will using two optimizer on same prefab losing performance?


    oh i see hiden can have it‘s own lod setting
     
    Last edited: Aug 16, 2022
  10. cowj

    cowj

    Joined:
    Mar 10, 2019
    Posts:
    17
    anohter question,using unity 2021.3.5f1,when delete To Optimizer List objects in prefab's Optimizer2 compoent in editor,this error shows

    A scripted object (probably FIMSpace.FOptimizing.Optimizer2?) has a different serialization layout when loading. (Read 372 bytes but expected 380 bytes)
    Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
     
  11. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    494
    You can try adding custom components to the "To Optimize" list and then adjust LOD settings, here example:
    upload_2022-8-16_15-51-40.png
    (download newest update on the store in order to see the MonoBehvaiour script names in "LODs" bookmark)

    I checked code for the mentioned error but couldn't find what causes it, I will check it more precisely the next days, thanks for reporting.
     
  12. EpicMcDude

    EpicMcDude

    Joined:
    Apr 15, 2013
    Posts:
    86
    Would you know how to run this manually when it's greyed out? upload_2022-8-20_18-11-46.png
    On a new Unity project the problem doesn't happen, but I don't want to reinstall Unity or make a create another project and import every single asset again at this stage.
     
  13. DanZ91

    DanZ91

    Joined:
    Sep 29, 2016
    Posts:
    6
    Unity 2022.1.14f1 HDRP
    Jobs package Version 0.70.0-preview.7


    1) On ParticleSystem, I added an optimizer with a static method, added Obstacle detection. And in play mode, the state only changes when the distance passes the LOD change point. And he does not care that he became visible or invisible due to an obstacle

    2) It is written that supports HDRP, but it is not. For light, practically nothing can be changed.

    3) Complex detection shape does not work. I added spheres to the model, but when blocked by obstacle, it does not hide.

    4) When I try to use Progressive Culling (Experimental). I get memory leak errors.

    5) How to create an optimizer through a script at runtime? I managed to add MeshRender to the optimizer, but nothing changes. In the game, he is always in one stage "Nearest"

    6) I have rooms generated. And I need to hide the whole room if it's not visible. As I understand it, I need Progressive culling. When will it be non-experimental?
    How can I now hide rooms that are not visible? This is definitely not obstacle detection. If somehow columns are located in the room (for example) so that all points are not visible, then it is unlikely that this will lead to something good

    7) How to forcefully turn off the entire optimizer so that all objects go into their normal state. And then turn on the entire optimizer so that all objects start working through the optimizer. What is it for? To bake ReflectionProbe in realtime for example. When creating rooms, I also create ReflectionProbe, and if the room is not visible through the optimizer, then in ReflectionProbe I bake only the sky
     
    Last edited: Sep 6, 2022
  14. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    494
    You need to make sure the coverage points are set properly with your particle system and use correct "Coverage Mask" layers for your project. (don't forget the obstacles needs to have collider!)
    In this tutorial you can find explanation for this feature:



    Are you using some custom lighting components?
    I just checked if something was changed in HDRP but it works, you just can't change intensity of shadows since HDRP controls them using different settings.


    You misinterpreted what Complex Detection Shape is for.
    It's only for detecting if model silhouette is visible in camera view, it's not responsible for detecting obstacles in a sight way.
    If you have really big model in shape of T, you don't want to opaque it whole in a giant sphere, but add few spheres to detect it's visibility in more detailed manner. It's very rare case when you use this feature.


    It seems unity DOTS updates broke something, I will need to check fix it.


    Optimizers are not compatible to create them runtime.
    Some users on the discord server found a way to do it, but it's not supported officially by me.
    Tool is dedicated to be adjusted in editor mode, inside prefab and just spawn the objects with adjusted and ready optimizer component on it.


    Your rooms are whole single meshes or it's built out of multiple tile models?
    If it's tiles, then each tile can have it's own optimizer and it can hide just invisible parts of the room.
    Progressive Culling could help, since it's detecting obstacles using their colliders (you can read about progressive culling under optimizers manual file)
    Hard to tell when progressive culling won't be beta, since as you noticed with the memory leak error, the Unity Jobs package which progressive culling is using, is not completed yet and it's still in "preview".


    There is method you can call with
    and it's SwitchOptimizersOnOrOff()
    and after calling it it's worth to disable system for your case (baking)
    with

    Code (CSharp):
    1.                 OptimizersManager.SwitchOptimizersOnOrOff(false, true);
    2.                 OptimizersManager.Instance.UpdateOptimizersSystem = false;
    and then restore everything with

    Code (CSharp):
    1.                 OptimizersManager.SwitchOptimizersOnOrOff(true, true);
    2.                 OptimizersManager.Instance.UpdateOptimizersSystem = true;
    To make sure it works, please update optimizers on the asset store and import it to your project.
     
  15. imaginationrabbit

    imaginationrabbit

    Joined:
    Sep 23, 2013
    Posts:
    344
    Hello- I'm getting a ton of these errors when the game first loads in builds-

    Code (CSharp):
    1. IndexOutOfRangeException: Index was outside the bounds of the array.
    2.   at FIMSpace.FOptimizing.Optimizers_CullingContainer.MoveStackOptimizerToFreeSlot () [0x0000d] in <95906405ef6d459f8ad51f9d86e98814>:0
    3.   at FIMSpace.FOptimizing.Optimizers_CullingContainer.RemoveOptimizer (FIMSpace.FOptimizing.Optimizer_Base optimizer) [0x00057] in <95906405ef6d459f8ad51f9d86e98814>:0
    4.   at FIMSpace.FOptimizing.Optimizer_Base.CleanCullingGroup () [0x00038] in <95906405ef6d459f8ad51f9d86e98814>:0
    5.   at FIMSpace.FOptimizing.Optimizer_Base.OnDestroy () [0x00008] in <95906405ef6d459f8ad51f9d86e98814>:0
    Any idea how to prevent them? Thank you.
     
  16. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    494
    Since I can't reproduce it on my side, can you send me your repro scene via PM or email?
    Or enable script debugging on build to display line number of code error.
     
    Last edited: Oct 3, 2022
  17. tianlinzhang

    tianlinzhang

    Joined:
    Mar 18, 2021
    Posts:
    8
    I have got same issue, can you provide clues on how to resolve the issue?
    IndexOutOfRangeException: Index was outside the bounds of the array.
    FIMSpace.FOptimizing.Optimizers_CullingContainer.GetId (System.Single[] distances) (at Assets/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizers Manager/Manager Helpers/Optimizers_CullingContainer.cs:291)
    FIMSpace.FOptimizing.Optimizer_Base.StartVariablesRefresh () (at Assets/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Base/Optimizer_Base.API.CullingMethods.cs:26)
    FIMSpace.FOptimizing.Optimizer_Base.Start () (at Assets/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Base/Optimizer_Base.cs:33)
    FIMSpace.FOptimizing.EssentialOptimizer.Start () (at Assets/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Essential/EssentialOptimizer.LODOperations.cs:31)

    After I totally remove Optimizer from the scene, I still got following error, I did not reference your Optimizer, why it got invoked?
    NullReferenceException: Object reference not set to an instance of an object
    FIMSpace.FOptimizing.OptimizersManager.get_Exists () (at Assets/FImpossible Creations/Plugins - Other/Optimizers 2/Additional Components/OptimizersManager.cs:91)
    FIMSpace.FOptimizing.Optimizer_Base.get_GetMaxDistance () (at Assets/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Base/Optimizer_Base.Variables.cs:24)
    FIMSpace.FOptimizing.Optimizer_Base.GetDistanceMeasures () (at Assets/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Base/Optimizer_Base.API.CullingHelpers.cs:35)
    FIMSpace.FOptimizing.Optimizer_Base.StartVariablesRefresh () (at Assets/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Base/Optimizer_Base.API.CullingMethods.cs:26)
    FIMSpace.FOptimizing.Optimizer_Base.Start () (at Assets/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Base/Optimizer_Base.cs:33)
    FIMSpace.FOptimizing.EssentialOptimizer.Start () (at Assets/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Essential/EssentialOptimizer.LODOperations.cs:31)

    I have to remove folder Assets/FImpossible Creations to get my scene work.
     
  18. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    494
    Hello, it looks like strange exception error.
    First one shouldn't ever happen, it's like unity didn't set any initial LODs when added optimizers component.
    The second is called by some optimizer component on scene lacking for OptimizersManager which is required and automatically added on scene if not existing.

    I submitted update on the store which should prevent this exceptions to break optimizers, but there is clearly something wrong happening and I can't reproduce it. Is there possibility for a repro scene?
     
  19. tianlinzhang

    tianlinzhang

    Joined:
    Mar 18, 2021
    Posts:
    8
    It works fine now after I download the new version, thank you for your prompt response. The optimizer changes user's game objects by adding a component, if you can add a button to give user the choice to clean up those components, it will be great.

    By the way, I am also using your "Animation Designer" now, after I installed it, I cannot see it in "Window" or "right click "Animator" component". The following two methods in your manual does not work, please check it, thank you.
    " To open the Animation Designer Window, you can hit the right mouse button on the unity’s Animator component and select the “Open in Animation Designer” option, which should be visible on the bottom of the menu popup. You can open Animation Designer one other way - by going to Unity Editor top bar “Window” bookmark -> “Fimpossible Creations” -> “Animation Designer Window”
     
  20. alex_1302

    alex_1302

    Joined:
    Aug 20, 2019
    Posts:
    48
    Hi. I have a question: ¿ how can i disable all optimizers using scripting? ¿maybe through the optimizer manager?

    Thanks in advance.
     
  21. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    494
    You can try disabling it using OptimizersManager.Instance.UpdateOptimizersSystem = false;
    but really it's not recommended since it can desynchronize api.
    If you need to disable optimizing on some selective objects it's better to use yourOptimizer.SwitchOptimizerEnabled() (check if you have the newest version from the asset store)
     
  22. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    779
    Awesome tools!
    I used Optimizers on all of the animals, objects, and terrains.
    You can do a lot more objects when doing video, but before adding Optimizers to everything it took twice as long to render the video. I also used FImposible's Look Animator, Spine Animator, and Tail Animators, and the free grounding tool! All excellent and time savings.
    This video is the last of a series we made and each have demonstrated these wonderful assets. Worth every penny!
     
  23. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    75
    Hello!
    Using Unity 2021.3.16f1 and URP, having a bunch of issues whenever I load into scenes with optimizers - mainly my FPS are lower with Optimizers than without. I use them on props and mobs, with static and effective optimizers depending on what moves and doesn't. The errors also pop up when I use the Optimizers exclusively on terrain components.

    These errors spam my console:


    Any idea what could be causing the errors or the frame drops I'm battling?
     
  24. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    494
    Hello,
    The errors are random editor GUI related errors and called only once so it shouldn't be a case here.
    You add one optimizer per mob/prop?
    How many props/mobs you use on the scene?
    Make sure you're not using game object deactivation for culling LOD.
    Are you using the features like obstacle detection or progressive culling?
    Make sure you're using the newest version of Optimizers.
    Can you post a screen with inspector window of one of your Optimizer LOD setups?
     
  25. melanke

    melanke

    Joined:
    Jan 27, 2018
    Posts:
    3
    Hello, I am considering buying your asset. My scene is generated at runtime, instantiating all game objects as tiles. Does this solution support this usecase?
     
  26. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    494
    For this case mesh combining will be better.
    There are plugins like Mesh Combine Studio or others which can give nice results for optimizing draw calls at runtime.
     
  27. MatthewValeBear

    MatthewValeBear

    Joined:
    Aug 1, 2022
    Posts:
    1
    Hi, we've been having issues for a while now with the plugin. I have attached screenshots below of the errors we always get. It doesn't prevent our game from functioning, but many errors like this can't be good? I'm aware Unity's DOTS system may have broken something as I saw in a previous post. Is there any update on this? I'm unable to send any repro scene but hopefully the errors below help? We are using the latest version.
     

    Attached Files:

    Ignacii likes this.
  28. Ignacii

    Ignacii

    Joined:
    May 23, 2013
    Posts:
    71
    I'm getting leak errors as well. And I can't find a way to cull objects when other objects are blocking them from the camera with the Progressive Occlusion Culling. I can't get Obstacles Detection to work either. But I was testing it not for what it was made for. I was using it for hundreds of layered procedurally generated tiles to be culled if obstructed by other tiles. I might try this asset again in the future for what it was made for and I hope I will get occlusion culling to work.
     
    Last edited: Feb 8, 2023
  29. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    494
    I uploaded an update yesterday but I am not sure if it fixes that since I can't reproduce it on my side.
    Right now I am working hardly on other plugins, but it looks it's not so far for the progressive culling turn. I will focus on this feature soon.
     
    Ignacii likes this.
  30. richGiraldo

    richGiraldo

    Joined:
    Nov 16, 2020
    Posts:
    1
    I have a problem with essential optimizers, I have hundreds of thousands of objects which when I select the object that has the essential optimizer component in the hierarchy the editor freezes for 4 seconds or more I can not modify anything.
     
    Ignacii likes this.
  31. alexgemini002

    alexgemini002

    Joined:
    Jan 15, 2020
    Posts:
    5
    dear developer, it seems have minor bug in lastest 2.2.1 version, when I add Optimizer 2(2019) component , and add navmesh agent and audio to optimizer list , it will produce NullReferenceException like below.
    NullReferenceException: Object reference not set to an instance of an object
    FIMSpace.FOptimizing.Optimizer2020LODsController.OnStart () (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer 2020/Optimizer2020 LODs Controller/Optimizer2020LODsController.cs:38)
    FIMSpace.FOptimizing.Optimizer2.RefreshInitialSettingsForOptimized () (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer 2020/Optimizer2020.Editor.cs:105)
    FIMSpace.FOptimizing.Optimizer_Base.Start () (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Base/Optimizer_Base.cs:34)
    FIMSpace.FOptimizing.Optimizer2.Start () (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer 2020/Optimizer2020.LODOperations.cs:33)
     
  32. alexgemini002

    alexgemini002

    Joined:
    Jan 15, 2020
    Posts:
    5
    it only happyed in navmesh agent and audio add to optimizer list, the mesh renderer component is ok, i work on unity 2021.3.20lts version.can you please verify it ?
     
  33. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    494
    If there is so many objects then it's probably too hard for unity to handle.
    Optimizer is holding references to the component in the list and inspector window is lagging when there is list with too many objects in the component (event if the list is not displayed).
    Optimizer component should be used on single prefabs or groups of objects, not on one gigantic group of objects.

    Thanks for reporting! It should be fixed now.
    There are global settings files for allowing/not allowing some components for automatic adding to optimize list "EssentialSelector" and "Optimizer2020Selector" (but drag & drop allowing adding the components anyway).
    By default navMeshAgent and AudioSource automatic adding is disabled, and the rule for generating initial LOD instance was also affected by this condition causing null reference.