Hello,
I’m making some project and have error:
even if i actually use " using UnityEngine.UI;".
You can see my code below. Am i doing something wrong? Or it’s just some bug?
What can i do with this?
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
public class Pilka2 : MonoBehaviour {
public float ballVelocity = 100;
public text wynikt;
Rigidbody rb;
bool isPlay;
int randInt;
int licznik;
void Awake()
{
rb = GetComponent<Rigidbody>();
randInt = Random.Range(1,3);
licznik = 0;
wynikt.text = "Wynik: " + licznik.ToString ();
}
void Update()
{
if (Input.GetMouseButton(0) && isPlay == false)
{
transform.parent = null;
isPlay = true;
rb.isKinematic = false;
if (randInt == 1)
{
rb.AddForce(new Vector3(ballVelocity, ballVelocity, 0));
}
if (randInt == 2)
{
rb.AddForce(new Vector3(-ballVelocity, -ballVelocity, 0));
}
}
}
void OnCollisionEnter (Collision col)
{
if(col.gameObject.name == "wrogprzyklad")
{
licznik = licznik + 1;
wynikt.text = "Wynik: " + licznik.ToString ();
}
}
}