#error when rebuilding

137 messages ยท Page 1 of 1 (latest)

tender mountain
#

I get this error in visual studios.
how do i fix it?

novel plume
#

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();
}
tender mountain
#

what do i do with these errors

tender mountain
quick hill
# tender mountain what do i do with these errors

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

tender mountain
#

i changed them both

#

@quick hill

glad carbon
#

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() ๐Ÿ™‚

tender mountain
#

so i have to change every OnLevelRemovedFromWorld() to NativeDestruct()

glad carbon
#

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 ๐Ÿ™‚

tender mountain
#

so do i replace virtual void OnLevelRemovedFromWorld(ULevel* InLevel, UWorld* InWorld) override; with void UOverheadWidget::NativeDestruct()
{
RemoveFromParent();
Super::NativeDestruct();
}

#

in both .h and .cpp?

glad carbon
#

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;

tender mountain
#

so after i replace that in .h i replace OnLevelRemovedFromWorld() with NativeDestruct() in .cpp? or do i need to change something else in .cpp

glad carbon
#

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 ๐Ÿ™‚

tender mountain
#

okay sp in .cpp i replace void UMenu::OnLevelRemovedFromWorld(ULevel* InLevel, UWorld* InWorld)
{
MenuTearDown();
Super::OnLevelRemovedFromWorld(InLevel, InWorld);
}

#

with virtual void UOverheadWidget::NativeDestruct() override;

glad carbon
glad carbon
#
void UMenu::NativeDestruct()
{
    RemoveFromParent();
    Super::NativeDestruct();
}
tender mountain
glad carbon
#

the .h file should just be virtual void NativeDestruct() override;

quick hill
#

Lol Jodie beat me to it ๐Ÿ˜‚

glad carbon
#

speed typing ๐Ÿ˜‚

quick hill
#

@tender mountain Also you need to go into UOverheadWidget and change it there aswell

glad carbon
quick hill
#

That's odd right there. I mean as long as it doesn't have override or call the Super it's totally fine

tender mountain
#

@quick hill

quick hill
#

Yes correct. That function in your screenshot no longer exists in UE5.x.x

glad carbon
quick hill
tender mountain
#

@glad carbon

quick hill
tender mountain
glad carbon
#

in the cpp file exactly like you did in the menu

quick hill
#

And in the header (.h)

tender mountain
glad carbon
#

where have you put NativeDestruct in the overhead widget class?

tender mountain
glad carbon
#

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

quick hill
tender mountain
#

found it, no errors now

quick hill
#

๐Ÿฅณ

glad carbon
#

good job ๐Ÿ˜Š

tender mountain
#

now i rebuild? and i should be able to open in ue?

glad carbon
#

yeah if there's no errors you should be fine ๐Ÿ™‚

#

๐Ÿคž

quick hill
#

Lol that too

tender mountain
#

you guys are the best! now i can start going through the course making everything lines up and add my character to it

quick hill
#

๐Ÿฅณ

glad carbon
#

awesome! have fun!

tender mountain
#

does it come with the level from the video?

glad carbon
#

if you have downloaded the project then yes, if not you'll need to make your own levels ๐Ÿ™‚

tender mountain
#

i downloaded it, when i open the project im on an island

glad carbon
#

so there should be a map called BlasterMap, that'll be the level Stephen designed ๐Ÿ™‚

quick hill
#

Also you always just create your own map, or even just use an empty level

tender mountain
glad carbon
#

in the content folder, there should be a folder called maps ๐Ÿ™‚

tender mountain
glad carbon
#

just double click to open it ๐Ÿ™‚

tender mountain
glad carbon
tender mountain
#

oh i see! my character doesnt move for some reason

#

i got it now

tender mountain
# glad carbon

when i create a session is says it failed to create one

glad carbon
#

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 ๐Ÿ™‚

tender mountain
glad carbon
#

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

tender mountain
glad carbon
#

if you're willing to give it a try, I would save the current one somewhere in case it goes wrong

tender mountain
glad carbon
#

double check your code contains all of the info that Stephen mentions in the pinned message at the top of the forum

tender mountain
glad carbon
#

aha

#

you need to add that then ๐Ÿ™‚

tender mountain
#

what createsession do i find
if (!SessionInterface.IsValid())
{
return;
}

#

@quick hill

quick hill
#

Uh beats me. I don't know anything about multiplayer

tender mountain
quick hill
#

Idk m80, just be patient and I'm sure someone will see this thread

glad carbon
#

did you add the code to your ini file? @tender mountain

glad carbon
#

[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
bInitServerOnClient=true

tender mountain
glad carbon
#

defaultengine.ini

tender mountain
glad carbon
#

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 ๐Ÿ™‚

tender mountain
glad carbon
#

yeah absolutely! yeah let me know and we'll keep trying if not ๐Ÿ™‚

tender mountain
glad carbon
#

no we use the same character but change the colour of their outfit to red or blue

tender mountain
glad carbon
#

did you regenerate files after adding it? ๐Ÿ™‚

glad carbon
#

okay send over the multiplayersubsystem code

tender mountain
glad carbon
#

and the cpp file please

tender mountain
glad carbon
#

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?

tender mountain
glad carbon
#

okay and can you move around etc

tender mountain
#

Not on the island no. Iโ€™m the game level I can

glad carbon
#

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.

tender mountain
#

i changed it in menu.cpp but no movement on the island

glad carbon
#

did you hard compile with the editor closed? ๐Ÿ™‚

#

this is what I fixed with the other guy lol

tender mountain
#

how you do that?

glad carbon
#

close unreal engine, then in visual studio, press CTRL + F5

#

it will compile and relaunch the engine

formal dust
#

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?

glad carbon
#

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

tender mountain
#

he can move now.
im trying from the editer, how do i make an exe?

glad carbon
#

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

formal dust
tender mountain
glad carbon
#

if you are testing on your own, put a 1 in the number of players box in the menu, then click host

tender mountain
glad carbon
#

that's definitely beyond my knowledge!

#

glad you're all fixed now ๐Ÿ‘

tender mountain
glad carbon
#

of course not, go ahead ๐Ÿ™‚