Skip to main content

Organizing Assets via Inheritance

1. PathTemplate Inheritance

PathTemplates can inherit from each other (similarly to other blueprint classes). This is especially useful for PathTemplates/TemplateGroups that describe intersections (contain multiple PathSplines). Such TemplateGroups require all of their PathTemplates to have matching/identical PathSplines.

While you can manually adjust the TemplateGroups to ensure that this requirement is met, it's much easier to introduce a PathTemplate superclass containing only the splines.

Attempting to spawn a Path with mismatching PathSplines yields an error:

PathSplines in PathTemplates have different shapes or count.

All PathSplines used for spawning a single Path should have matching PathSplines (same name, count, number of points, locations, rotations, tangents). The best way to ensure that is to derive from a single parent PathTemplate (blueprint) that has only the PathSplines.

An example of the PathTemplate inheritance is shown on the pictures below:

  • The superclass blueprint. Note that it derives from PathTemplate, and contains both PathSplines. The road mesh has also been added to this blueprint to ease path spline adjustment. Note that the road mesh has spawning disabled (in the properties), as we want the road blueprint to handle that mesh.

PathSplines

  • The subclass blueprints. They derive from the superclass and share the PathSplines defined there.

Road Decals

2. PathDescription Inheritance

Another convenient asset benefiting from inheritance usage is the PathDescription. It's often a good idea to create a generic BP class inheriting directly from the PathDescription class, to store default values for e.g. PathAdjustmentProperties or landscape adjustment. You can then add specific PathDescriptions inheriting from that generic class, specialized for different path types.

3. Other Paths assets

Other Path asset blueprints, such as PathfindingProperties or LandscapeAdjustmentProperties, can also benefit from using inheritance. Follow similar steps to introduce superclasses for those assets.