I have a lot of blueprint actors that share information with each other. For example, you can pick up an item and while holding it, click on another actor and it will pass some info to that actor. Example: Press on a jar while holding a beaker with liquid in it, the jar fills up with liquid and a string is passed to the beaker about what kind of liquid it was filled with.
Two things are set in this process:
- A boolean (IsFilled) that sets the visibility of the liquid component in the beaker.
- A string (LiquidType) that determines other logic downstream.
So I have heard that using Casting in Blueprint is not necessarily recommended in Blueprint, since it doesn’t have the concept of headers and thus whenever you cast to an actor blueprint, it loads the entire actor’s data into memory, which can be slow and wasteful.
In response, I thought to myself: “Well, then I’ll just make an interface Set Bool and one called Set String and call that instead of casting to an actor.”
But what has happened is that I’ve created 4 of these types of interfaces at this point:
- Set Bool
- Set Vec
- Set String
- Set Float
and I’m starting to feel silly about it. Is this really the way to go? Also, if I have to set more than one float, would I not need:
- Set Float1
- Set Float2
… - Set FloatN
?
This seems redundant and stupid. This can’t be the way to go, right?
How do you do it correctly?