The point of the Interface

Hi All,

I was wondering what the point of using an interface is both in this situation and in general? I Have read the unreal docs and they say that with common functions but unrelated inheritances it can be useful which i can kind of see to avoid very clumsy switches or unnecessary functions but I don’t get what Sam was talking about with changing the dependencies for moving code across projects.
Surely by including the game instance to the game menu this is cleaner and only has 1 dependency? It could be changed if we insert the menu to another game and all we would have to do is change 1 include and a couple of words?

Thanks
Jack

@sampattuzzi ?

It all depends on your goal but the dependency is still only one: from the GameInstance to the Menu. That’s why it’s called dependency inversion. Imagine I was trying to sell this on the app store to somebody who just wants to use Blueprint. I can’t ask them to open the C++ and change it. That’s an extreme example but dependency inversion can stop out classes from getting overly familiar with each other which can really help maintainability.

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms