Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Adding Solvers to Obi Updaters at Runtime
#3
(17-09-2023, 05:39 AM)scionious Wrote: Figured it out:

obiMasterFixedUpdater.GetComponent<ObiUpdater>().solvers.Add(solver);

Remove the same way with .Remove(solver)

Probably should do this in a new thread, but what's the process for doing this with WindZones? Is there a measurable performance cost with just instancing a new one for each enemy instance? I'd like to add them the same way, but I think it's an Array instead of a List and I'm not sure I have enough brain cells to figure that one out.



Code:
///WINDZONES
        //Copy current weather system state to a temp list
        tempSolverList.Clear();
        foreach (ObiSolver solver in obiMasterWindZone.affectedSolvers)
        {
            tempSolverList.Add(solver);
        }

        //Add new solvers to list for inheriting wind
        foreach (ObiSolver solver in obiSolversToInheritWind)
        {
            tempSolverList.Add(solver);
        }

        //Write all solvers to array
        obiMasterWindZone.affectedSolvers = tempSolverList.ToArray();

And figured out the Force Zones. This is a pretty ok way to do this?

Also, why am I getting huge 20ms spikes in LateFixedUpdate from Obi when I'm only using FixedUpdate as far as I know? 
Is this a side-effect of using a bunch of Proxies?

I have around 70 solvers in the scene, with a Single ObiFixedUpdater component and and an AmbientForceZone component.
I'm using proxies on those 70 solvers  - is this why?

Any other way I can get double sided cloth in URP with proper lighting?
Reply


Messages In This Thread
RE: Adding Solvers to Obi Updaters at Runtime - by scionious - 17-09-2023, 07:17 AM