- Home /
Problem only in release Build
Hi,
I'm currently trying to build a release version of our game, but unfortunately I get a problem in the release version of the project, and only there. In the editor everything is fine. Debugging doesn't help, I got no errors and the debug version in the editor runs as intended.
I have a small smooth follow script for a camera that follows a car. In the editor it's fine, but in the release version the camera points from the side at the car and doesn't turn at all. It has a fixed rotation and only travels with the car. I have no idea what the problem might be. Any idea?
Thanks
This is the code:
public class SmoothFollow : MonoBehaviour
{
public Transform target;
private Vector3 lookAtPos;
public Vector3 lookOffset;
public float distance = 10.0f;
public float height = 5.0f;
public float heightDamping = 2.0f;
public float rotationDamping = 3.0f;
void LateUpdate ()
{
if (target == null)
return;
lookAtPos = target.transform.position + lookOffset;
float wantedRotationAngle = target.eulerAngles.y -180;
float wantedHeight = target.position.y + height;
float currentRotationAngle = transform.eulerAngles.y;
float currentHeight = transform.position.y;
currentRotationAngle = Mathf.LerpAngle (currentRotationAngle, wantedRotationAngle, rotationDamping * Time.deltaTime);
currentHeight = Mathf.Lerp (currentHeight, wantedHeight, heightDamping * Time.deltaTime);
var currentRotation = Quaternion.Euler (0, currentRotationAngle, 0);
transform.position = target.position;
transform.position -= currentRotation * Vector3.forward * distance;
transform.position = new Vector3 (transform.position.x, currentHeight, transform.position.z);
transform.LookAt (lookAtPos);
}
}
Does it work when you compile it as a "development build" ?
Sorry for the delay. No, same problem in the development build.
This could be a bug in Unity. Could you try removing things until you get the smallest project possible that reproduces the problem?
Thanks for the idea. The smooth follow script seems to interfere with something else. If I remove everything it works as intended. However I have hundreds of scripts and assets in the project that are linked together. It would take weeks to remove them one after another and build the game each time.
Can you check the output_log.txt and see if there are any errors?