Announcement

Collapse
No announcement yet.

Create variables at runtime?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Create variables at runtime?

    How do you create new variables at runtime?

    Let's say I'm reading a text file and I read the name: StepUpAndDown. Now I want to create a new variable called StepUpAndDown after the game has already begun aka at runtime.

    #2
    How are you using the variable afterwards? Will it always be the same type (bool, float, vector, etc)?

    If you just want the string "StepUpAndDown" to be stored, you'd just create an array of strings. Add that string to it in-game. Then access it by it's index.

    If you needed "StepUpAndDown" to point to another value, e.g a float, you'd create a Map with a string as the key and float as the value.
    Then add "StepUpAndDown" and it's corresponding float value in-game. Then access the value using "StepUpAndDown" with the find node.
    Last edited by Kristiamo; 08-20-2017, 05:52 AM.

    Comment

    Working...
    X