Hello! This is my first post in this forum so I would like to thank you all for the great community you’ve built. I have a question regarding user input in the OnInput function. I understand that said function receives an FString (pointer?) as an argument. My question is, can and should we use the TEXT macro on the Input argument? I understand that this is not done in the lecture but why is that? Is Input already formatted appropriately and if so, how can we distinguish when we should use TEXT() and when not?
I’m new at this as well, so take my thoughts with a grain of salt. However, from what I understand, the TEXT macro is simply used when you are trying to output text onto the screen. OnInput is just a function that takes IN text that the user types in and converts it to an FString. You can then store that string into an FString variable and then use it in a TEXT output log, however you’ll have to format it using the %s command within your text.
So in short, I believe TEXT is only used when you’re trying to display text on the terminal or on screen. Hopefully I understood the question correctly.
Thank you for your response! The thing is, whenever I use TEXT on the Input FString I get an error. Is TEXT only valid for string literals?
Can you show an example of how you’re trying to use it?
Yes it’s only for string literals. It prepends L
on Windows to make the string literal of type const wchar_t[N]
instead const char[N]
as wchar_t
is the data type Windows uses to store Unicode code points.
Thank you!
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.