I think my editor is bugged and i don't know how to fix it.

Hi, i’m starting a UE5 project for the first time and as i was making my game, i began having some issues with casting. At first it all started slow, if i played on the editor for a bit, my castings would suddenly stop working, even if they were working just fine a few minutes before.

Sometimes when the casting stopped working, it wouldn’t come back if i restarted the test, it would only come back if i restarted my PC (sometimes not even that). At that point i was pretty sure i was doing some kind of mistake and spent some time researching casting and all that.

In the meantime while i was trying to figure out what i was doing wrong, i decided to package the game, to find out how that worked (wanted to know how long it would take and what size it would be).

To my surprise, after packaging the game and launching it, the casting would work just fine, no problems at all. Even though it was working in the packaged version, i didn’t want to have a bad code that consumes too much memory and CPU usage, so i decided to implement an interface and instead of casting, i was going to use a bunch of events and functions to send variables from one blueprint to the other (since it seems to be the most correct way of doing it).

And well…guess what, now i have another problem! Not only my casting won’t work, but whenever i try to create a widget by using an interface function, in the editor, the widget doesn’t get created and added to the viewport.

I tried packaging the game again to see if it would work there and it did…

So right now i’m really confused, I’ve searched the internet quite a bit and didn’t find someone with this problem.

My guess is that my project got corrupted? I honestly have no idea.

Was wondering if someone here might be able to help me with that?

Thanks in advance!

It sounds like a timing problem. The order that things initialize in editor, and in a packaged game is not the same, which could explain it.

I’d recommend making a very cut down version of the problem, get that working 100%, then go back to your main game and find out what the difference is.

Are you getting any errors when you stop play?

It’s also worth looking in the log.

1 Like

Hey, thanks for answering!

Hmmm, i didn’t really think about the initialization…not really sure where i would start to look. So far i have a Character blueprint that on begin play, creates a widget. When i press a button on that widget, i want to make another widget. I don’t call any functions from said widget before creating the character…not sure if it’s about this kind of thing you’re talking about.

I’ll try making two other blueprints and recreating these issues, see if it works then.

And no, i get no errors when i stop playing.

I’m also really new to UE5, where can i find said logs? ^^‘’

Once again, thanks for the help. :smiley:

I didn’t know how simple or complex your game was.

This is the log, you can have it open while you’re playing

1 Like

The project so far is really simple, i only have a couple of widgets with a bunch of math behind it. Character stats, loading, saving and that kind of thing.

I’ve opened the log, and this is what i got:

“LogSlate: InvalidateAllWidgets triggered. All widgets were invalidated
LogSlate: Updating window title bar state: overlay mode, drag disabled, window buttons hidden, title bar hidden
LogAudioMixer: FMixerPlatformXAudio2::StopAudioStream() called. InstanceID=24
LogAudioMixer: FMixerPlatformXAudio2::StopAudioStream() called. InstanceID=24
LogUObjectHash: Compacting FUObjectHashTables data took 6.07ms
LogPlayLevel: Display: Destroying online subsystem :Context_36
LogDebuggerCommands: Repeating last play command: Selected Viewport
LogPlayLevel: PlayLevel: No blueprints needed recompiling
PIE: New page: PIE session: UltraReal (Jul 25, 2023, 7:09:23 AM)
LogPlayLevel: Creating play world package: /Game/UEDPIE_0_UltraReal
LogPlayLevel: PIE: StaticDuplicateObject took: (0.001819s)
LogPlayLevel: PIE: Created PIE world by copying editor world from /Game/UltraReal.UltraReal to /Game/UEDPIE_0_UltraReal.UltraReal (0.001860s)
LogChaos: FPhysicsSolverBase::AsyncDt:-1.000000
LogAIModule: Creating AISystem for world UltraReal
LogPlayLevel: PIE: World Init took: (0.001135s)
LogUObjectHash: Compacting FUObjectHashTables data took 5.26ms
LogAudio: Display: Creating Audio Device: Id: 25, Scope: Unique, Realtime: True
LogAudioMixer: Display: Audio Mixer Platform Settings:
LogAudioMixer: Display: Sample Rate: 48000
LogAudioMixer: Display: Callback Buffer Frame Size Requested: 1024
LogAudioMixer: Display: Callback Buffer Frame Size To Use: 1024
LogAudioMixer: Display: Number of buffers to queue: 1
LogAudioMixer: Display: Max Channels (voices): 0
LogAudioMixer: Display: Number of Async Source Workers: 4
LogAudio: Display: AudioDevice MaxSources: 32
LogAudio: Display: Audio Spatialization Plugin: None (built-in).
LogAudio: Display: Audio Reverb Plugin: None (built-in).
LogAudio: Display: Audio Occlusion Plugin: None (built-in).
LogAudioMixer: Display: Initializing audio mixer using platform API: ‘XAudio2’
LogAudioMixer: Display: Using Audio Hardware Device Speakers (2- USB Audio Device)
LogAudioMixer: Display: Initializing Sound Submixes…
LogAudioMixer: Display: Creating Master Submix ‘MasterSubmixDefault’
LogAudioMixer: Display: Creating Master Submix ‘MasterReverbSubmixDefault’
LogAudioMixer: FMixerPlatformXAudio2::StartAudioStream() called. InstanceID=25
LogAudioMixer: Display: Output buffers initialized: Frames=1024, Channels=2, Samples=2048, InstanceID=25
LogAudioMixer: Display: Starting AudioMixerPlatformInterface::RunInternal(), InstanceID=25
LogAudioMixer: Display: FMixerPlatformXAudio2::SubmitBuffer() called for the first time. InstanceID=25
LogInit: FAudioDevice initialized.
LogAudio: Display: Audio Device (ID: 25) registered with world ‘UltraReal’.
LogLoad: Game class is ‘CharacterCreation_C’
LogWorld: Bringing World /Game/UEDPIE_0_UltraReal.UltraReal up for play (max tick rate 22) at 2023.07.25-10.09.24
LogWorld: Bringing up level for play took: 0.000737
LogOnline: OSS: Created online subsystem instance for: :Context_37
PIE: Server logged in
PIE: Play in editor total start time 0.331 seconds.”

Edit: Didn’t get any additional lines when i pressed the button with the function and another with a cast.

It doesn’t look very interesting.

If you get yellow or red lines, take a look at them.

Maybe you can show your code?

1 Like

No yellow or red lines, and sure thing, here’s the stuff that is causing problems.

To give a bit of context, this is the Character BP, at the start it creates the main menu widget.

The main menu widget creates two additional widgets which are kind of unrelated to the problem, i think. I’ve made them to populate a character list and to make a settings menu.

Inside the Main menu widget however, i have a button that calls a function from the character to create a new menu, to decide what type of character creation you want.

image

Right now this “step by step” widget is being created here in the main menu widget, because in the editor it didn’t seem to be working when i tried to create it from the character.

Then finally, i have the step by step widget, where i use the character function to make the new widget. As it is right now, if i play it with the editor, the last widget “personalidade” won’t be created nor added to the viewport, but it works on the packaged version as i mentioned earlier.

Only two things I notice.

If you’re so sure this event will be called right after widget creation, just call it in the widget.

  1. There’s a very unhealthy relationship between the widgets and the player. A player can create widgets, and at a stretch, call events in widgets. But it’s not cool for widgets to call things inside the player. I’m not really into it as much as you, but I get a very ‘circular’ sensation here. Might you have a loop here?

In general, there’s this concept of ‘decoupling’ in coding. What it means is, as much as possible, everything that can be, should be a black box to everything else.

So the player knowing about what’s in widgets, is not too bad, if the player created those widgets. But those widgets then knowing about the player is not ok :wink:

It’s a tricky concept when you start out. But even if you code everything with absolute precision, tight coupling will lead to other problems, such as inexplicably large levels and assets, which you will eventually track down to the relationship between blueprints.

1 Like

Maybe if you me what the widgets are, and what they do, I can help?..

1 Like

Hey, sorry for the late reply, I was really busy and didn’t get any sleep. lol

Yeah, i thought that what i’m doing now is kinda wierd, the relationship between the widgets and the player was a bit different when i was casting, i think, so i might have to work a bit on that. As for the loop, i guess it’s an option, but i don’t really see where it would be looping, to be honest, i’ll have to take a better look later today.

Yeah, this project i have is kinda wierd, to be honest, it’s basically a widget game, based on pen and paper RPG. I can send you some more info about the widgets later, sure.

I don’t have the energy to do it right now, but i’ll send it later tomorrow, if you’re still willing to give me a hand, i’ll accept it. :slight_smile:

Either way, once again, Thanks for all the help!

1 Like

Yes, I don’t think there’s a loop. It might be widgets on top of each other, but I don’t really know :wink:

1 Like