I dont know if this is where i put this.
Im trying to build my game and… “Error building Player because scripts have compile errors in the editor” and nothing more… So i have no idea what the problem is.
Im using two scripts in my game:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Playermovement : MonoBehaviour {
public float MovementSpeedForward;
public float MovementSpeedHorizontal;
public Text countText;
public Text winText;
private Rigidbody rb;
private int count;
// Use this for initialization
void Start()
{
rb = GetComponent<Rigidbody>();
count = 0;
SetCountText();
winText.text = "";
}
// Update is called once per frame
void FixedUpdate ()
{
transform.Translate(Vector3.forward * Time.deltaTime * MovementSpeedForward);
if (Input.GetKey(KeyCode.A))
transform.Translate(Vector3.left * Time.deltaTime * MovementSpeedHorizontal);
if (Input.GetKey(KeyCode.D))
transform.Translate(Vector3.right * Time.deltaTime * MovementSpeedHorizontal);
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Pickup"))
{
other.gameObject.SetActive(false);
count = count + 1;
SetCountText();
}
if (other.gameObject.CompareTag("Goal"))
{
other.gameObject.SetActive(false);
winText.text = "You got: " + count.ToString();
}
}
void SetCountText()
{
countText.text = "Points: " + count.ToString();
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Rotate_pickup : MonoBehaviour {
// Update is called once per frame
void Update ()
{
transform.Rotate(new Vector3(15, 30, 45) * Time.deltaTime);
}
}
Please help…