Question by
Wolfshadow · Mar 15, 2016 at 01:56 PM ·
c#error messageif-statementsoperatorequal
C# Greater Than or Equal To
Hello everyone. It seems like there would be a lot of documentary on this question, but I can't do anything I have found. I want to have an If statement that is, if variable1 >= 25, do x. My code looks like:
using UnityEngine;
using System.Collections;
public class buildfighter : MonoBehaviour {
public int M;
void Update ()
{
GameObject EconomyManager = GameObject.Find ("EconomyManager");
economy economyscript = EconomyManager.GetComponent<economy> ();
M = economyscript.metal;
}
void Start ()
{
if (M >= 25)
{
Debug.Log(":)");
}
}
}
These lines are what are giving me trouble:
void Start ()
{
if (M >= 25)
{
Debug.Log(":)");
}
}
I get this error: Operator >=' cannot be applied to operands of type
int' and `string'
I can't understand what is wrong, and I can't use other resources to decipher it. I am sorry for a question like this, but I hope you all can help.
Thanks, Wolfshadow
Comment