Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

Help with strings

$
0
0
Hello guys I'm running into an issue. I have a string that I want to lose a letter if backspace is pressed. Here is my code.
if(Input.GetKeyDown (KeyCode.Backspace)){
stringToEdit= stringToEdit.Substring(0,stringToEdit.Length-1);
Debug.Log ("Backspace is pressed");
}
This should work and I know it has something to do with the stringToEdit.Lenght. If i put in my own value for the length it would work just fine. Does anyone know why this is happening?
Incase you need to see the entire code here...

Help with strings

Viewing all articles
Browse latest Browse all 1466670

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>