Hi! I am a beginner in Unity and I got this notification. I am doing the RollABall tutorial. Could someone put their PlayerController.cs script and tell me what I did wrong? I’m using NotePad ++ btw. ( I’m also getting a hang of these code tags, so if I do it wrong I am so sorry.)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
public class PlayerController : MonoBehaviour {
public float speed;
public Text countText;
public GameObject winTextObject;
private float movementX;
private float movementY;
private Rigidbody rb;
private int count;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody>();
count =0;
SetCountText();
winText.text="You Win!";
winTextObject.SetActive(false);
}
void FixedUpdate()
{
Vector3 movement = new Vector3 (movementX, 0.0f, movementY);
rb.AddForce(movement * speed );
}
void OnTriggerEnter(Collider other)
{
{
if(other.gameObject.CompareTag("PickUp"))
other.gameObject.SetActive(false);
count = count + 1;
SetCountText();
}
}
void OnMove(InputValue movementValue)
{
Vector2 v = value.Get<Vector2>();
movementX = v.x;
movementY = v.y;
}
}
void SetCountText()
{
countText.text = "Count: " + count.ToString();
if(count >=12);
{
winText.text = "You Win!";
winTextObject.SetActive(true);
}
}
