December 5, 2018 at 18:15 #24180R3ALParticipant
Hi, I’m working on the AI part of my game and managed to cobble together a test scene that spawns 5 enemy NPCs and 1 player NPC. I’ve created all the necessary AI scripts. When I click play, I lose a dramatic amount of FPS. This is on a plane scene with nothing but a plane and a couple of cubes.
I reviewed the Unity profiler and noticed the following : LoadBalancerComponent.Update() -> FindObjectsOfType spiking to 45% or so.
Normally when this occurs on a script I write, it’s because it’s looking for a component that doesn’t exist (no errors). My AI scripts are far from optimized (currently working on it). Can you point me in the right direction in order to troubleshoot this?
I have 3 spawn points and the only action the enemy NPCs are performing is to run away when my player character is within a certain distance from them. I have Apex Path and Steer installed in addition to the Utility AI. There are no customized movement patterns just the standard find best position. I’ve set the load balancer for each component to Auto.
I’m not sure it’s relevant but all I’m doing is to scan for the player entity and decide on what action to take based a set of conditions. I used your Survival Tutorial as a starting point. Modifying it a bit to fit my needs and character controller.
ThanksDecember 5, 2018 at 21:42 #24188R3ALParticipant
Please disregard. I figured out that all the load balancer does is run my scripts. I located the offending script making the findobjectbytype calls.
You must be logged in to reply to this topic.