Be the first to post for 'Solution: Injecting Dependencies'!

If you’re reading this, there probably aren’t very many posts yet. But don’t worry, you can be the first! Either create a new post or just reply to this one to say ‘hi’.

Great lecture! The fact that the interface function names have to match the function that they call had me rewatching for hours trying to find where I went wrong- I had simply not used the function name “Host” in the main menu as you did! Doh!

Could I have done a better job of preparing you for that?

I unfortunately paused a minute or two before you got the same error and explained why- the fact that you had a successful compile and I didn’t with seemingly the same steps threw me off, but it was all down to the names not matching. Perhaps if you mentioned that they must match before when you were creating the interface functions, it could help. I should have just kept watching even without a successful compile. Great section!

Hello I have a problem and I’m not so sure how to fix it.
After this lecture and implement the interface for the menu, when I press Host I get these error:

LogNet: NotifyAcceptingConnection: Server MainMenu refused

LogWorld: Warning: SetActiveLevelCollection attempted to use an out of date NetDriver: GameNetDriver

If I press Host button, I got those errors and I know it;s because I’m calling:


in Host function in the GameInstance class.

Before this lecture, I didn’t have any problems with this method.
Any help? Thaks in advance

What other changes did you make in this lecture?

I am following the lectures as they are. I don’t think I changed anything else only the things from the video.

Yeah same here my function in game instance was not called Host.

For some reason though despite correcting this, the Host function on my game instance class is not getting called, despite no error in passing the menu widget its interface pointer :thinking:

Edit: so far it looks like menu interface is indeed null. F***TW

turns out when i tried to get rid of that awful disambiguation of

this->MenuInterface and changed its name to MainMenuInterface.

It was a typo all along!

void UMainMenu::SetMenuInterface(IMenuInterface* MenuInerface) 
	MainMenuInterface = MenuInterface;

Visual studio couldnt catch this error because it was setting MenuInterface equal to itself, just like Sam was trying to avoid

The error was here where i typoed Interface with Inerface
(IMenuInterface* MenuInerface)

I assumed this was fine until i had a rest and decided to try to change its name anyway.

You would think visual studio would underline it with a green squiggly …

I mean when would somebody intentionally set a = a without disambiguation?
I could understand if there really was two differnt versions of a; it would be nice if visual studio was checking to see if there really was two versions when it sees such a thing

9/10 it’s always a typo! Oops

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

Privacy & Terms