Ok, so I’m new to Unity and C# but I wrote a tiny script which runs without a problem inside Unity.
But when I try to export it (build) I get a bunch of errors all telling me types are not found, and it’s pretty much all the types I used… So it doesn’t find MonoBehaviour, Vector3 or Transform.
The script looks like this :
-
using System.Collections.Generic;
using UnityEngine;
public class CameraBehaviour : MonoBehaviour {
Vector3 myVectorZ;
Vector3 myVectorY;
Vector3 myVectorX;
Transform myTransform;
void Awake () {myTransform = GetComponent<Transform> (); myVectorZ = new Vector3 (myTransform.position.x, myTransform.position.y, myTransform.position.z+2); myVectorY = new Vector3 (myTransform.position.x, myTransform.position.y+2, myTransform.position.z); myVectorX = new Vector3 (myTransform.position.x+2, myTransform.position.y, myTransform.position.z);
}
// Use this for initialization
void Start () {}
// Update is called once per frame
void FixedUpdate () {
if ( Input.GetKey( “space” ) )
{ transform.Translate( myVectorZ , Space.Self);
Debug.Log (“Fixed :”);
Debug.Log (myTransform.position.z); }
}
void Update () {
if ( Input.GetKey( “space” ) )
{ transform.Translate( myVectorZ , Space.Self);
Debug.Log (“NotFixed :”);
Debug.Log (myTransform.position.z); }
}
} *
I’m guessing I didn’t think of a simple thing that ruin everything but I didn’t find an answer fitting my problem.
Sorry if I’m not clear, not english… Thanks in advance for your answers !