- Home /
How do I split a word into individual characters and display them in a tile
I'm working on a word game and I haven't been able to figure out how to split a word like "BEST" Into individual characters like this "B" "E" "S" "T" and then display them in a tile like a scrabble piece. This is my first word-based game and I will appreciate any help. I'm sorry if it seems too basic or might already have an answer somewhere here
Comment
Answer by Casiell · Mar 18, 2021 at 12:25 PM
String is just an array of chars, so you can iterate over it in a for loop and spawn a tile for each character. Something like this
for (int i = 0; i < str.Length; i++)
{
SpawnTile(str[i]);
}
Your answer
Follow this Question
Related Questions
Do I need to destroy objects I'm not using? 4 Answers
My character is floating. How do I fix this? 1 Answer
TileMap won't show up in 2d object in heirarchy. 0 Answers
"Random" Rule Tile 3 Answers