#error when rebuilding
137 messages ยท Page 1 of 1 (latest)
Hi MILK CAT, the function OnLevelRemovedFromWorld is no longer valid to use with UE 5.1. Use NativeDestruct() instead.
void UOverheadWidget::NativeDestruct()
{
RemoveFromParent();
Super::NativeDestruct();
}
what do i do with these errors
i uploaded the project if you could help
https://drive.google.com/file/d/19yMns6yA-gKnAo_jMw9GKKxZSKwMrqs4/view?usp=share_link
This error is simply caused by the fact you either declared that function in the header (.h) and didn't define it in the cpp or you defined it in the cpp and didn't declare it in the header. All those other "errors" are a result of IntelliSense having personal issues and aren't actual errors. If you look in the top right of your error log there, you'll see a drop down that says Build + IntelliSense change it to Build Only
Hey, they meant like this: ๐
you can't declare a function inside another function, you need to delete OnLevelRemovedFromWorld() completely and replace it with NativeDestruct() ๐
can i get the does for those?
so i have to change every OnLevelRemovedFromWorld() to NativeDestruct()
yes ๐ although I only remember using it this one time in Menu
I have OnLevelRemovedFromWorld in OverheadWidget.cpp, but it's completely empty and not being used, so that doesn't matter, it can probably just get deleted ๐
so do i replace virtual void OnLevelRemovedFromWorld(ULevel* InLevel, UWorld* InWorld) override; with void UOverheadWidget::NativeDestruct()
{
RemoveFromParent();
Super::NativeDestruct();
}
in both .h and .cpp?
if you have functionality in your OnLevelRemovedFromWorld function then yeah absolutely, but if it's empty then you don't need to ๐
the .h file only needs the declaration too, so just virtual void UOverheadWidget::NativeDestruct() override;
so after i replace that in .h i replace OnLevelRemovedFromWorld() with NativeDestruct() in .cpp? or do i need to change something else in .cpp
yeah replace it in cpp as well, you can't have a function in the cpp file if it isn't also in the .h file, so leaving it will give an error ๐
okay sp in .cpp i replace void UMenu::OnLevelRemovedFromWorld(ULevel* InLevel, UWorld* InWorld)
{
MenuTearDown();
Super::OnLevelRemovedFromWorld(InLevel, InWorld);
}
with virtual void UOverheadWidget::NativeDestruct() override;
has to be the same class name so not UOverheadWidget, use UMenu
this is the code you need here ๐
void UMenu::NativeDestruct()
{
RemoveFromParent();
Super::NativeDestruct();
}
so this is still an error
the .h file should just be virtual void NativeDestruct() override;
Well yes because it's virtual void NativeDestruct() override;
Lol Jodie beat me to it ๐
speed typing ๐
@tender mountain Also you need to go into UOverheadWidget and change it there aswell
that one is odd, I still have onlevelremoved (etc) but the function is empty, so it doesn't throw any errors at me lol
That's odd right there. I mean as long as it doesn't have override or call the Super it's totally fine
this should also be virtual void NativeDestruct() override;
@quick hill
Yes correct. That function in your screenshot no longer exists in UE5.x.x
yeah I assumed as it's totally empty that it just skips past it, I might just delete it tbh as it isn't used lol
Yeah lol if it's totally empty it skips it, well in this case it does ๐
now i have these new errors after those
@glad carbon
Right because once more you defined the function but didn't declare it.
where do i do that?
in the cpp file exactly like you did in the menu
And in the header (.h)
so what do i replace with what?
where have you put NativeDestruct in the overhead widget class?
i removed it from overheadwidget.cpp
the error says you have it somewhere in the overhead widget, either the cpp or h file, or that you are calling UOverheadWidget::NativeDestruct() somewhere
In the .h you should have this virtual void NativeDestruct() override; in the cpp you should have this void OverheadWidget::NavtiveDestruct() {}
found it, no errors now
๐ฅณ
good job ๐
now i rebuild? and i should be able to open in ue?
Just hit F5
Lol that too
you guys are the best! now i can start going through the course making everything lines up and add my character to it
๐ฅณ
awesome! have fun!
does it come with the level from the video?
if you have downloaded the project then yes, if not you'll need to make your own levels ๐
i downloaded it, when i open the project im on an island
so there should be a map called BlasterMap, that'll be the level Stephen designed ๐
Also you always just create your own map, or even just use an empty level
where do i find the map? i plan on creating my own but would like to test
in the content folder, there should be a folder called maps ๐
oh i see so how can i change the map in ue?
just double click to open it ๐
in ue? i dont see it
when i create a session is says it failed to create one
okay you're having the same issue as someone else now, must be something to do with downloading the project. you'll have to bare with me while I try to figure it out ๐
thank you, let me know what yall figure out. i set players to 1 and it said that but didnt take me to the game map. is that cause it didnt create a session?
yeah if it fails to create the session, it can't transport you anywhere
not sure why it's failing for both of you though
thats odd, do i need to put the 5.1 plug in in the plug ins folder? like replace it maybe?
if you're willing to give it a try, I would save the current one somewhere in case it goes wrong
I tried it and it didnโt work
double check your code contains all of the info that Stephen mentions in the pinned message at the top of the forum
i dont even see [OnlineSubsystemSteam]:
bInitServerOnClient=true in the ini
i cant find CreateSession
what createsession do i find
if (!SessionInterface.IsValid())
{
return;
}
@quick hill
Uh beats me. I don't know anything about multiplayer
who would know?
Idk m80, just be patient and I'm sure someone will see this thread
did you add the code to your ini file? @tender mountain
Which code?
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
bInitServerOnClient=true
Which ini does that go in? Sorry Iโm not at my pc atm
defaultengine.ini
Okay Iโll try that in the morning. Anything else I need to add or change? Did it start working for the other person?
the other guy was having a different issue in the end, we'll see if adding the code to the ini file works first and go from there ๐
Okay thank you. Iโll ping you when I gave it a shot. Trying to get everything working before I start customizing everything ๐
yeah absolutely! yeah let me know and we'll keep trying if not ๐
Also off topic of multiplayer. Does each team have different characters? Or has someone implemented character choices?
no we use the same character but change the colour of their outfit to red or blue
i put the code in and still cant create server
did you regenerate files after adding it? ๐
yup
okay send over the multiplayersubsystem code
and the cpp file please
and can you send the menu cpp file please
when you click HOST, does it send you to the lobby or are you still on the menu screen?
the menu goes away and my character stands on the island
okay and can you move around etc
Not on the island no. Iโm the game level I can
can you send me a screenshot of after you click host please
to be able to move after clicking host, you need to change this code:
void UMenu::NativeDestruct()
{
RemoveFromParent();
Super::NativeDestruct();
}
to this:
void UMenu::NativeDestruct()
{
MenuTearDown();
Super::NativeDestruct();
}
please let me know if this works.
i changed it in menu.cpp but no movement on the island
did you hard compile with the editor closed? ๐
this is what I fixed with the other guy lol
how you do that?
close unreal engine, then in visual studio, press CTRL + F5
it will compile and relaunch the engine
You said you can't create the session, but are you trying to do that in the PIE or are you trying it from the packaged game?
also yes, you will always get Failed To Create Session whilst pressing play within the editor, it will only create a session if you package the game and open the exe. file, or right click your project and press launch game
he can move now.
im trying from the editer, how do i make an exe?
you click platforms at the top, click Windows (if you are using a windows machine), click Development and then click Package Project
this will then make a new folder with an exe. file which you double click to open and can play
you MUST be logged into Steam for a session to be created
is this the first C++ course you take?
it seemed like it worked, i clicked hose and no error but was stuck on the island and couldnt exit. I though when you were waiting you had free cam in the game level?
if you are testing on your own, put a 1 in the number of players box in the menu, then click host
yup seems to work, even steam says invite your friends to play. wonder if theres a way to make a server list
thank you, mind if add you as a friend incase i need more help? you helped so much i appreciate it
of course not, go ahead ๐