Hello, I am trying to make a console to run commands and I have a problem with actually getting the command/
An example command that I have is to load a level
I know that this way works, but it is sloppy and inefficient:
using UnityEngine;
using System.Collections;
public class LevelModifier : MonoBehaviour {
public UIInput uii;
void Start () {
uii = GetComponent<UIInput>();
}
void OnSubmit(){
if(uii.text == "loadLevel 0"){
Application.LoadLevel(0);
}else if(uii.text == "loadLevel 1"){
Application.LoadLevel(1);
}else if(etc,etc){
}
}
}
I vaguely remember using %i in c++ but I don't think it will apply in this situation.
What would be the best method for going about getting the number in the string?