- Home /
Problem after building
Hello! I have a very strange problem: when I play my game in Unity it works fine but after building it, the camera has a very bad problem. I have attached a video to show you what I mean. Do you know a solution?
http://www.youtube.com/watch?v=7VNilqzAz9w&feature=youtu.be
Greetings
Tough to say without knowing more about the project. Do you have multiple cameras? Is your controller script maybe forcing your camera to look up when you move?
First, try looking at the log file for your build. Then, add a bunch of debug statements to your camera controller script. If you can narrow it down a bit, we can probably help you.
I have no multiplay cameras in the scene. Here is my movement script:
using UnityEngine;
using System.Collections;
public class $$anonymous$$ovement : $$anonymous$$onoBehaviour {
//Variables
public float gravity = 20.0F;
public float speed = 6.0F;
public float jumpSpeed = 8.0F;
public float vScale = 1.0F;
public float crchSpeed = 3F;
public float runSpeed = 1.0F;
private Vector3 moveDirection = Vector3.zero;
//Camera
public Animation run;
public Animation cameraidle;
void Update() {
CharacterController controller = (CharacterController)GetComponent(typeof(CharacterController));
// is the controller on the ground?
if (controller.isGrounded) {
//Feed moveDirection with input.
moveDirection.Normalize();
moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
moveDirection = transform.TransformDirection(moveDirection);
//$$anonymous$$ultiply it by speed.
moveDirection *= speed;
// Animation.Play("cameraidle");
// Animation.Stop("run");
//Jumping
if (Input.GetButton("Jump"))
moveDirection.y = jumpSpeed;
if (Input.Get$$anonymous$$ey ("left shift"))
moveDirection *= runSpeed;
// Animation.Stop("carmeraidle");
}
moveDirection.y -= gravity * Time.deltaTime;
controller.$$anonymous$$ove(moveDirection * Time.deltaTime);
}
}
Your answer

Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Camera Changes Proportions In Build 1 Answer
MissingComponentException: There is no 'Camera' 0 Answers
Camera issue (storing temp variable C# problem) 3 Answers
Problem with start game.exe 1 Answer