- Home /
BehaviourUpdate taking unreasonable amounts of resources in the profiler
I'm getting issues with performance in the BehaviourUpdate portion of the profiler, but all of its sub-components do not add nearly to the amount of time BehaviourUpdate is taking. I've disabled V-Sync. What's going on here?
See the image attached to see what I mean.
I have very few scripts running in my scene. Only an extended first person controller and a simple compass.
Are you sure that you don't get any errors in your console? The StackTraceUtility is usually only used when there is either an error or when you manually use Debug.Log every frame.
Try a deep-profile. Note that deep profiling itself adds quite a few overhead but it might help to figure out the cause.
Jeeze that is definitely ridiculous, I was just reviewing my profiler and was sitting at 123b for about 120 active objects with complex scripts. As bunny said, this is definitely from errors, your stacktrace is through the roof.
On runtime I'm getting the error:
ArgumentException: Input Axis Gamepad Look X is not setup.
To change the input settings use: Edit -> Project Settings -> Input
UnityStandardAssets.CrossPlatformInput.PlatformSpecific.StandaloneInput.GetAxis (System.String name, Boolean raw) (at Assets/Standard Assets/CrossPlatformInput/Scripts/PlatformSpecific/StandaloneInput.cs:10)
UnityStandardAssets.CrossPlatformInput.CrossPlatformInput$$anonymous$$anager.GetAxis (System.String name, Boolean raw) (at Assets/Standard Assets/CrossPlatformInput/Scripts/CrossPlatformInput$$anonymous$$anager.cs:108)
UnityStandardAssets.CrossPlatformInput.CrossPlatformInput$$anonymous$$anager.GetAxis (System.String name) (at Assets/Standard Assets/CrossPlatformInput/Scripts/CrossPlatformInput$$anonymous$$anager.cs:95)
UnityStandardAssets.Characters.FirstPerson.$$anonymous$$ouseLook.LookRotation (UnityEngine.Transform character, UnityEngine.Transform camera) (at Assets/FirstPersonExploration$$anonymous$$it/Standard Assets/Characters/FirstPersonCharacter/Scripts/$$anonymous$$ouseLook.cs:45)
UnityStandardAssets.Characters.FirstPerson.FirstPersonController.RotateView () (at Assets/FirstPersonExploration$$anonymous$$it/Standard Assets/Characters/FirstPersonCharacter/Scripts/FirstPersonController.cs:257)
UnityStandardAssets.Characters.FirstPerson.FirstPersonController.Update () (at Assets/FirstPersonExploration$$anonymous$$it/Standard Assets/Characters/FirstPersonCharacter/Scripts/FirstPersonController.cs:72)
I pursue this and a line in question is
public override float GetAxis(string name, bool raw)
{
return raw ? Input.GetAxisRaw(name) : Input.GetAxis(name);
}
The error could be in the First Person Exploration $$anonymous$$it from the asset store, in which case the lines in question are:
yRot = CrossPlatformInput$$anonymous$$anager.GetAxis("Gamepad Look X")*XSensitivity;
gameObject.GetComponent<$$anonymous$$ouseLook>().LookRotation(transform, m_Camera.transform);
I'm not sure what the problem with this would be, though. I've pursued all of the lines mentioned in the error report, and nowhere does it explicitly state the format of the Look X string. In other threads I've seen it's often just a matter of writing "Horizontal" in the correct format, but I can't find any hard-coded strings. How could I fix this?
Also, I ran the deep profiler and found this:
Yeah, go to Edit > Project Settings > Input, and add the missing axis.
It took me a while to realize that I had to make my own custom axis to make this work, rather than editing the "Horizontal" axes.
Performance is back up to speed, thank you so much! I'd love to give you reputation if you want to post it as an answer
Answer by RobAnthem · Mar 20, 2017 at 04:06 AM
If anyone has this issue in the future.
Go to Edit > Project Settings > Input
And add the appropriate axis, to increase the size of inputs, resize the array to be 1 larger, or click on any element and press CTRL + D.
Then change the name of the new axis to reflect that of the one being requested. In this case, it is "Gamepad Look X"