How does a cast to a pawn as opposed to an interface make maintenance more difficult? If they’re both just places to have functions abstracted (what difference does it make if its in a base class vs an interface)?
As explained, in order to keep things in one place :).
Also I don’t understand why it matters that the movement component can see the door or lower windows functions, if it never calls them isn’t that the same as if they were never visible through the cast?
It is S in Solid :P. Some junior will come in, use method to open windows in movement component. And then senior joins the company, gets the bug that windows are opened when car break harshly, and last place he will look will be movement component. By using interfaces, you prevent any potential misusage, and separate responsibilities accordingly.
Do casts actually load the entire pawn like the static meshes etc.?
Pawn is loaded anyways, we are talking abou references or pointers here. So when you cast to interface, it only takes those methods and that’s it. Technically it is the whole object, and in Java, if I recall correctly, you can cast it back to the full object. But if packages are separated properly, then you will be unable to do so. Because the Movement component (for example), will only know about the interface, and not about the whole pawn. Which prevents this cast back to the whole object. This is more about the architectual thing. And is explained more in details if you look at the factory pattern
tutorials.
If the interface doesn’t load the static meshes, then what happens if I reference the static mesh in an override of the interface function like in GetOwnedGameplayTags()
?
This is your decision to make. By using Interface you decide what will be exposed, and technically you can expose everything you want. But you should also follow up on the KISS principle. And keep it as simple and as stupid as possible, so expose only the simple stuff. And encapsulate control over the pawn.
Sorry for all of the questions, I just want to be clear what the actual use cases of interfaces are.
Don’t be sorry, I’m here to help.