Hello Everyone !
With some friend, we are planning to create a custom Tower defence. I’m preparing everything and I got a problem in a simple code, there it is, there is 2 scripts, first is the Mobb script and the sedonc is the GameManager, My problem is that I can’t start the code cause, there " publicstaticintvie=5;" it’s telling me this " Assets/GameManager.cs(26,22): error CS0029: Cannot implicitly convert type int' to bool’ "
Here is the full paste code with a line of separation between both scripts:
GameManager :
Your error is on line 38 apparently, but I don’t know what your code is.
However, your GameManager should simply be this now:
using UnityEngine;
using System.Collections;
public class GameManager : MonoBehaviour {
public static int vie = 5;
public TextMesh textevie;
void Update() {
// Create a string of dashes, one for each life
textevie.text = new String('-', vie);
}
}
Ah, new error Assets/GameManager.cs(10,37): error CS0246: The type or namespace name `String’ could not be found. Are you missing a using directive or an assembly reference? on the string, I let you check it
Ya, use the lower case ‘string’ instead. You wont need the ‘using’ command I suggested.
I was just copy / pasting from online, and they used the System.String class.