Page Info
Engine Version:

Class Creation Basics

Choose your OS:


These examples show how to create a new class using Blueprints only, C++ code only, and a combination of C++ code and Blueprints. The goal is to create new LightSwitch classes with the same properties and behavior using all three workflows, and then add an instance of each new class to the level, so there are three new LightSwitch Actors.

LightSwitch classes are based directly on the Actor class, since their primary requirement is that they can be placed within the level. They contain a PointLightComponent as the root component, and a SphereComponent that is a child of the PointLightComponent. Each LightSwitch class also has a variable called DesiredIntensity, which is used to set the intensity of the PointLightComponent. Finally, the default behavior of the classes is that when the player enters or leaves the SphereComponent, the PointLightComponent's visibility will be toggled.