Daniel Falci
Sign in Buy the course

Casting in Blueprints (theory): what Cast To does and when to use it

Cast To is a more versatile way to communicate than direct reference: besides accessing one specific Blueprint, it can access a specialized version of a Blueprint, several Blueprints of the same class at once, or one specific child of a parent Blueprint. It tests whether the object is of that class and, if so, gives you access to its members.

See the course Watch a free lesson

From the course

Taken from the hands-on project of the course; the lessons show every step on video.

When do I use Cast To?

How is it different from a direct reference?

A direct reference points to one particular instance. Cast To asks whether an object is a given class, which also covers specialized versions and child classes, and gives you that class's variables and functions.

A mental model

Think of it as asking this object: are you a BP Table? If yes, you can use everything a BP Table has. The practical guide that follows builds a purchase system this way.

Free PDFs that go with this page

One-page guides made from the lessons, sent by e-mail.

Frequently asked questions

What does Cast To do?

It converts or tests an object as a specific class so you can access that class's data and functions.

When should I use it instead of a direct reference?

When you need to reach specialized versions, child classes or many instances of the same class.

Can I reach only one child class?

Yes. For example, only BP Table out of a Furniture family.

Related guides

See the course