Simple level

my rooms are simple i didn’t want to spent a lot of time on design i uploaded the code because i learned to declare the variables on the .h when i first learned about class systems

It’s a good idea to start with a basic level to learn the concepts, but I don’t think, that writing the variables into the header is a good idea. Declaring the variables in the header-file makes them attributes of that class. Doing this will make them available in all methods of that class. The values will remain saved until the object gets deleted, otherwise (like it was shown in the course) the values will get lost after BeginPlay() is finished. Doing it like this is good in case you need the values more often (like using the owner in many functions or when there’s an openDoor() method) because you won’t need to get them every time. In this particular case we need them only once, so its a waste of memory to let them exist while we don’t need them anymore.

1 Like

Privacy & Terms