Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. 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:
    117
    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:
    550
    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:
    117
    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:
    510
    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:
    550
    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:
    117
    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:
    550
    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:
    764
    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:
    550
    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:
    117
    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:
    550
    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:
    349
    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:
    550
    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:
    550
    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:
    54
    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:
    550
    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:
    850
    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!
     
    LasOne likes this.
  23. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    215
    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:
    550
    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:
    550
    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:
    125
    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:
    550
    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:
    24
    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:
    24
    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:
    550
    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.
     
  34. FcsVorfeed

    FcsVorfeed

    Joined:
    Aug 15, 2014
    Posts:
    51
    1) if ParticleSystem renderer component is removed, it will still auto add to list
    this will result in a runtime error


    2) May I ask whether EssentialOptimizer or Optimizer2 is better for the latest version?
     
  35. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    1) Are you sure you're using the newest version on the store? I can't reproduce this error.

    2) EssentialOptimizer can handle few types of unity components and handling this types of components is hard coded.
    Optimizer 2 is using unity's feature "SerializeReference" which allows to implement custom component types to handle without much effort.

    No more differences between the components. I still recommend using Essential Optimizer since in the past I experienced few bugs with the "SerializeReference" feature and I don't trust it in 100%, but I assume that in the newest unity versions it should work fully correct.
     
  36. FcsVorfeed

    FcsVorfeed

    Joined:
    Aug 15, 2014
    Posts:
    51
    yes I am sure is the lastet version,I mean the Gameobject have the particleSystem Component,But remove the particleSystem.renderer child compoment (no remove the particleSystem Component)
     
  37. alexgemini002

    alexgemini002

    Joined:
    Jan 15, 2020
    Posts:
    24
    dear developer:
    the terrain optimizer seems not working,I created a new scene, add a terrain , attach terrain optimizers component to it, it produce 4 exception,below is log. I'm using unity3d 2021.3.23 and optimizers 2.2.1(may 19). can you verify it?


    Exception 1:
    NullReferenceException: Object reference not set to an instance of an object
    FIMSpace.FOptimizing.LODsControllerBase.GenerateLODParameters (System.Boolean hard) (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Base/LOD Controller/LODsControllerBase.Settings.cs:20)
    FIMSpace.FOptimizing.ScriptableOptimizer.ResetLODs (System.Boolean hard) (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Scriptable/ScriptableOptimizer.Editor.cs:126)
    FIMSpace.FOptimizing.ScriptableOptimizer.OnValidateUpdateToOptimize (System.Boolean hard) (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Scriptable/ScriptableOptimizer.Editor.cs:73)
    FIMSpace.FOptimizing.Optimizer_Base.OptimizerOnValidate () (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Base/Optimizer_Base.Editor.cs:298)
    FIMSpace.FOptimizing.Optimizer_Base.OnValidate () (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Base/Optimizer_Base.cs:100)
    FIMSpace.FOptimizing.TerrainOptimizer.OnValidate () (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Additional Components/TerrainOptimizer.cs:336)
    FIMSpace.FOptimizing.ScriptableOptimizer.OptimizerReset () (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Scriptable/ScriptableOptimizer.Editor.cs:35)
    FIMSpace.FOptimizing.Optimizer_Base.Reset () (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Base/Optimizer_Base.cs:117)
    FIMSpace.FOptimizing.TerrainOptimizer.Reset () (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Additional Components/TerrainOptimizer.cs:36)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)

    exception 2 :
    NullReferenceException: Object reference not set to an instance of an object
    FIMSpace.FOptimizing.LODsControllerBase.GenerateLODParameters (System.Boolean hard) (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Base/LOD Controller/LODsControllerBase.Settings.cs:20)
    FIMSpace.FOptimizing.ScriptableOptimizer.ResetLODs (System.Boolean hard) (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Scriptable/ScriptableOptimizer.Editor.cs:126)
    FIMSpace.FOptimizing.ScriptableOptimizer.OnValidateUpdateToOptimize (System.Boolean hard) (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Scriptable/ScriptableOptimizer.Editor.cs:73)
    FIMSpace.FOptimizing.Optimizer_Base.OptimizerOnValidate () (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Base/Optimizer_Base.Editor.cs:298)
    FIMSpace.FOptimizing.Optimizer_Base.OnValidate () (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Base/Optimizer_Base.cs:100)
    FIMSpace.FOptimizing.TerrainOptimizer.OnValidate () (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Additional Components/TerrainOptimizer.cs:336)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)

    exception 3:
    ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    System.Collections.Generic.List`1[T].set_Item (System.Int32 index, T value) (at <4a4789deb75f446a81a24a1a00bdd3f9>:0)
    FIMSpace.FOptimizing.Optimizer_Base.EditorResetLODValues (System.Boolean logWarning) (at Assets/TPCode/FImpossible Creations/Plugins - Other/Optimizers 2/Code/Optimizer Base/Optimizer_Base.Editor.cs:456)
    FIMSpace.FOptimizing.Optimizer_BaseEditor.OnEnable () (at Assets/TPCode/FImpossible Creations/Editor/Plugins - Editor - Other/Optimizers 2/Optimizers.Editor.Variables.cs:106)
    FIMSpace.FOptimizing.ScriptableOptimizerEditor.OnEnable () (at Assets/TPCode/FImpossible Creations/Editor/Plugins - Editor - Other/Optimizers 2/ScriptableOptimizer.Editor.cs:21)
    FIMSpace.FOptimizing.OptimizerEditorTerrain.OnEnable () (at Assets/TPCode/FImpossible Creations/Editor/Plugins - Editor - Other/Optimizers 2/TerrainOptimizer.Editor.cs:26)

    exception 4:
    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <b55589eb06c2466f99929d8dd849fc32>:0)
    UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <b55589eb06c2466f99929d8dd849fc32>:0)
    UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <b55589eb06c2466f99929d8dd849fc32>:0)
    FIMSpace.FOptimizing.OptimizerEditorTerrain.GUI_PreLODLevelsSetup () (at Assets/TPCode/FImpossible Creations/Editor/Plugins - Editor - Other/Optimizers 2/TerrainOptimizer.Editor.cs:55)
    FIMSpace.FOptimizing.OptimizerEditorTerrain.GUI_CategorySelectorAndDraw (UnityEngine.RectOffset zeroOff, System.Single bgAlpha, System.Int32 headerHeight) (at Assets/TPCode/FImpossible Creations/Editor/Plugins - Editor - Other/Optimizers 2/TerrainOptimizer.Editor.cs:75)
    FIMSpace.FOptimizing.Optimizer_BaseEditor.DrawNewGUI () (at Assets/TPCode/FImpossible Creations/Editor/Plugins - Editor - Other/Optimizers 2/Optimizers.Editor.cs:161)
    FIMSpace.FOptimizing.Optimizer_BaseEditor.OnInspectorGUI () (at Assets/TPCode/FImpossible Creations/Editor/Plugins - Editor - Other/Optimizers 2/Optimizers.Editor.cs:97)
    UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <b0203fd7dd2d48d6b95c7da9408b4a30>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)
     
  38. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Can you describe how to reproduce it?
    I tried it with your Unity version, on a few terrains but no errors.
     
  39. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    503
    Hey this asset is really great.

    I have a question though. I have one Prefab which I instantiate with multiple scales between 1-500 Units. However the "Detection Bounds" always stay at 1. Must they all be the same size for performance reasons (similar like we should use same culling distances) or can I update the "Detection Bounds" with no issues when the Prefab is Instantiated?

    Thanks a lot!
     
  40. SOL3BREAKER

    SOL3BREAKER

    Joined:
    Oct 11, 2021
    Posts:
    47
    Why I can't add animator to optimizer, I want to turn it off when it's far enough, and what about disabing the whole gameobject.

    I don't know why, but it becoms very laggy in editor even I didn't expand the component or component list if I added a lot gameobject into one optimizer.
     
  41. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    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.
     
  42. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    503
    Any thoughts on this? Thanks.
     
  43. LasOne

    LasOne

    Joined:
    Mar 10, 2015
    Posts:
    3
    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. https://docs.dungeonarchitect.dev/unity


    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.



     
    dsilverthorn likes this.
  44. hehui568350701

    hehui568350701

    Joined:
    May 17, 2023
    Posts:
    5
    Hello, do you support occlusion culling of dynamic concave polygon objects in the scene?
     
  45. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    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.
     
  46. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    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.
     
  47. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    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.
     
  48. FcsVorfeed

    FcsVorfeed

    Joined:
    Aug 15, 2014
    Posts:
    51
    Why WatchUpdate take so much CPU performance?
    QQ截图20230711022431.png
     
  49. FcsVorfeed

    FcsVorfeed

    Joined:
    Aug 15, 2014
    Posts:
    51
    I often get an error when I switch scenes
    upload_2023-7-11_4-41-45.png
     
  50. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    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.