adampliska
New member
I might have found a bug in the TransformLook ViewType. I use this viewtype to "zoom into" objects in my game world. So I flip between a 3rd person viewtype and this first person transform look view type. If I enable the transformlook viewtype, and set the proper move and rotation targets, then unzoom (going back to the 3rd person view type) (also I set the move/rotation targets to null) and then close the application - I get an error.
In this case the error is started in the CameraController.OnDestroy method. The system calls InitializeCharacter(null) to clear out the character. This leads to each view type's AttachCharacter method being called. When the TransformLook view type's AttachCharacter method is called, null is passed for the character. In the AttachCharacter method there is a small bit of code that checks to see if the move target OR the rotation target is null, and in that case, use the character transform. Finally, the code will attempt to get the animator for the character, which is null. This leads into an extension method. thre is no null check in that extention method and so the code tires to access a value from a dictionary with a null key - error.
I recommend either updating the FirstPersonController.TransformLook script to check for null characters and avoid trying to access the animator OR
update the GetCachedComponent extension method to check for a null game object and returning null if detected.
-- Adam
In this case the error is started in the CameraController.OnDestroy method. The system calls InitializeCharacter(null) to clear out the character. This leads to each view type's AttachCharacter method being called. When the TransformLook view type's AttachCharacter method is called, null is passed for the character. In the AttachCharacter method there is a small bit of code that checks to see if the move target OR the rotation target is null, and in that case, use the character transform. Finally, the code will attempt to get the animator for the character, which is null. This leads into an extension method. thre is no null check in that extention method and so the code tires to access a value from a dictionary with a null key - error.
I recommend either updating the FirstPersonController.TransformLook script to check for null characters and avoid trying to access the animator OR
update the GetCachedComponent extension method to check for a null game object and returning null if detected.
-- Adam