Announcement

Collapse
No announcement yet.

Where to store logical constants

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

    Where to store logical constants

    Hello everyone,

    I have various constants (e.g a constant uint8 TileSize) that I need to access in my c++ code as well as in my blueprints. Where should I best store such data so that I can modify it from editor (if possible a big plus but not extremely important) and can access it from both c++ and blueprints?

    Thank you
    Bugmee

    #2
    UDataAsset:

    https://api.unrealengine.com/INT/API...set/index.html
    | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

    Comment


      #3
      But with UDataAsset I now need to have a reference to that specific asset everytime I want to access those constants, right? I can't just do
      Code:
      UMyConstants::TileSize
      in order to get the tile size. Is there a way to get access to the constants without having to store a reference to a specific DataAsset everywhere?

      Comment


        #4
        Is this also appropirate for NPC dialogue and stuff like that?

        Comment


          #5
          You said you want to edit default values on the editor.
          ​​​For that you need an asset containing a default object...

          Otherwise I would just create a static class and a function library to change static variables from Blueprints when needed. And forget about editing defaults from editor UI.
          | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

          Comment

          Working...
          X