enum only returning first entry
So I have two blueprints, which currently are not working. Both blueprints try to pull and use data from an enum (different enums in each blueprint). In each instance, the first entry from the enum is called.
The first enum is used to make an in game calendar, where the date appears. The enum is called up in the widget blueprint for the UI (as pictured below; I've added in the print for debugging purposes). The int-int function is not in the execute path because I was testing to see if it was as simple as removing that bit. The array (game date) is set-up as follows: day (0), month (1), year (2). The corresponding functions for day and year work, and do not use enums.
The path (after the clamp) is: int to byte>byte to E_MonthNames > enum to string > string to text. Also I have tried this with and without the clamp, with no differences.
As can be seen by the debug text in the second image, the date is correctly updating the month behind the scenes so I know the script in GameState is correct. The calendar has updated to 15/07/2 (yeah year 2), yet the UI and the print script from first screenshot show 'January' instead of 'July',
I realize I have probably missed something very simple in the scripts but just in case I made a mistake elsewhere, here is a copy of the enum:
Likewise, I'm having the same issue with a script that should pull random names from two different enums (based on gender) with pretty much identical setups to the above script. The major difference is I am not pulling external information into this script, like with the other taking information from other scripts.
The use of 'MaleNameTest' was to test if setting the variable solved the issue. Regardless if the name was set as a second variable (as seen in the true path) or just passed through (as seen in the false path) it made no difference. The result was still the first entry from the correct table for the the sex of the NPC (e.g., all female NPCs got the name 'Sarah' instead of a random name from the table).
Thanks in advance for your help.
Found a solution. Despite what every tutorial or document I have seen said, I cannot use 'literal enum' this way. The set up is the same as what is currently pictured, except instead of 'literal enum' I have created a variable (or two in the case of the second example) where the selected information from the enum is stored. This is then passed through enum to script.
Works perfectly now.
answered Jan 19 '19 at 05:32 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here