How can I make it so that my game reads letter images as letters or text?

Hello, so I’m a new programmer and I am currently making a game similar to bookworm adventures. So one of the main features of the game was to create words so that you can defeat the enemy. My current issue is that I want to make it so that like bookworm adventures, I can create words using letter tiles and make it so that unity can read it as a word using letter tile images. Is this possible or is there a way to do this? Thank you and I really hope that I am being clear and sorry if this sounds confusing.

1 Answer

1

Attach a custom script to your letter object and maybe call it “Letter”. Create a public char variable where you can save your letter value (“a”, “b”, “c”, etc…). Then, in another script, maybe the level manager or a word manager - you name it - you’ll be able to access the Letter component and its value. Concatenate them into a single string which is going to be your word.

You should also use ScriptableObject for doing this, instead of creating a GameObject prefab. In the scriptable object you can then set your texture and your value for each of the letters you want to use, with a single and easily accessible format.