I figured it out
I know this is a basic error but i can't find out how to make my float into text here if my code,
using UnityEngine; using System.Collections; using UnityEngine.UI; public class AntiCheat : MonoBehaviour { private float Health = 100; private float ammo = 30; private float reloadamount = 30; private float backupammo = 420; private float ammoloseamount = 1; public Text Healthtxt; public Text Ammotxt; public Text leftoverammotxt; public string Ammo; public switctweapons _switctweapons; private void Healthanticheat(){ if (Health > 100) { Health = 100; } } void start(){ Ammotxt = "Ammo:" + Ammo.ToString(); leftoverammotxt = "backupammo:" + backupammo.ToString; } void Update () { Ammotxt; if (Input.GetButtonDown ("Fire1")) { ammo - ammoloseamount; } if (ammo == 0) { backupammo - reloadamount; ammo.Equals(30); } if (reloadamount == 0) {
}
}
}
If anyone needs it the error i am getting is this, Assets/Animations/Scripts/AntiCheat.cs(30,50): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
Follow this Question
Related Questions
Unity freeze when open script,I keep trying to open a script, but it freezes Unity. Please help. 1 Answer
How to make object spawn only once? 1 Answer
Take damage only when attack animation is done? 1 Answer
Can someone please help me find out what wrong with my code. 1 Answer
Adding points from another script 1 Answer