Use this as a roadmap for learning scripting

  1. Levels
  2. Game Mode
  3. Game Instance
  4. Player controller
  5. Pawns
  6. Scriptable Objects
  7. Player state
  8. Game state


But before heading into creating your first level, you need to learn some theory about the event system.

The classes in the list above are what we refer to as gameplay classes. Every gameplay class has 1 thing in common with all others, the common event functions listed below:

virtual void tick(float deltaTime);
virtual void beginPlay();
virtual void endPlay();

These functions are going to be called automatically when needed


The tick function will get called every frame until the death of the given class


The beginPlay function will only be called when the class is created for the first time


The endPlay function will only be called when the class is near destruction, for the reasons listed below

  1. A level was opened
  2. The application was closed
  3. The given class had to be replaced by another

Constructor and Destructor

The constructor should only be used for initialization of variables or for functionality that isn't dependent on the engine's features, while the destructor needs to be able to fully reset the class. You ABSOLUTELY NEED to make sure your destructor leaves your class in the same state as it would be if it were created as a new variable. Additionally, make sure you're not executing heavy and slow operations.

For performance reasons, the engine pre-initializes and instance of every gameplay class. The UVKBuildTool takes care of generating code that initializes all the gameplay classes on the stack. This way, we have most of our internal data stored as stack pointers, instead of as heap allocated ones. Essentially, this moves all data from the gameplay classes closer to the CPU cache and makes read/write/access operations significantly faster. Due to this, however, we cannot trivially delete classes as we could with heap allocated data and are forced to essentially reuse old classes if needed, which is why we need you to fully clean up all your data.


The hierarchy of classes looks like this: Hierarchy

You might notice that one class is missing, and that is the Scriptable Object class. This is because they are independent of the hierarchy and are entirely owned by the engine's systems.

So as you can see there is a clear division between all types of gameplay class, so choosing the right one for the job is critical to your application's inner functionality