A Graphic Designer trying... unity and c#

hey guys, I just started a course on c# and unity… new at both. I was just experimenting thing beyond what I learned, four modules in and this happened:

The thing is it took me forever to do this, is there a faster way to create something like this?

Hi Nuno,

Faster way to do what exactly? Without knowing what your goal was and what you did, it is impossible to tell whether there is a faster way.

If you are able to describe the concept and figure out a pattern, you will certainly be able to find a way to generate content via code.

Also please feel free to ask our helpful community of students for further ideas over on our Discord chat server.

1 Like

Hi Nina,

sorry for that. My workspace right now looks like this:

So I have 3 scenes, one scene loader, and then one for the upper case and other for the lower case. What you see in the screenshots is me creating for each script of the letter, 36 key down presses and giving each element its correspond letter. I have done this for all numbers, upper and down cases. I WENT BANANAS! :sweat_smile:

I do not mind do this, it’s just for fun, but would be quicker to learn if I could skip repetitive processes like these.

Thank you a lot

Please note, it’s better to copy/paste your code and apply the code fencing characters, rather than using screenshots. Screenshots are ideal for displaying specific details from within a game engine editor or even error messages, but for code, they tend to be less readable, especially on mobile devices which can require extensive zooming and scrolling.

You also prevent those that may offer to help you the ability to copy/paste part of your code back to you with suggestions and/or corrections, meaning that they would need to type a potentially lengthy response. You will often find that people are more likely to respond to your questions if you make it as easy as possible for them to do so.

What’s the purpose of the nextLeters array? And have you already watched lecture “For Loops” in the Text Adventure section in the Unity 2D course? Depending on what your goal is, Rick’s solution could be more efficient.

Theoretically, if all you want to do is to display a glyph which is associated with a key, and if the KeyCode matches the glyph, you could use the ToString method of the KeyCode enum and Input.anyKeyDown. If the glyphs don’t match the KeyCodes, you need to map them manually like you did with your nextLeters array. An alternative would be a dictionary, where you look up the current pressed key.

As aforementioned, if you have a pattern, you can easily have the computer do the job for you. If you don’t have a pattern, you will have to do everything by yourself.

Hope this helps :slight_smile:


See also;

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms