Oh yeah thanks, I’ll try it!
Because that’s actually the proper way to do it.
Destroy gets rid of it and any variable.
when you re-spwan you usually create a new actor from the class so that all the variables are reset.
The Problem: Game crashes after 3-4 seconds or so, showing this error.
Assertion failed: DelegateOwner->IsValidLowLevelFast(false) [File:D:\Program Files\Epic Games\UE_4.27\Engine\Source\Runtime\CoreUObject\Public\UObject/SparseDelegate.h] [Line: 196]
UE4Editor_Core
UE4Editor_Core
UE4Editor_Monster_Shooter_0015!AEnemy::BeginPlay() [D:\Game Development and Programming\Monster_Shooter\Source\Monster_Shooter\Enemy.cpp:48]
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Monster_Shooter_0015!AEnemy::Tick() [D:\Game Development and Programming\Monster_Shooter\Source\Monster_Shooter\Enemy.cpp:58]
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Core
UE4Editor_Core
UE4Editor_Core
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll
References:
Error code line 48 in Enemy.cpp file.
DamageCollision->OnComponentBeginOverlap.AddDynamic(this, &AEnemy::OnHit);
Error code line 58 in Enemy.cpp file.
if (!CurrentVelocity.IsZero())
BP_Enemy Blueprint.
Idle / Walk to Dead Transition in BP_Enemy_Animation Blueprint.
Because that’s actually the proper way to do it.
Destroy gets rid of it and any variable.
when you re-spwan you usually create a new actor from the class so that all the variables are reset.
Yes, you are absolutely right, no problem there.
But what about setting “owner=self” in Spawn Actor? Wouldn’t that cause problems because “self” was destroyed?
Ok so what should I do now?
Owner on a character can’t really be self.
It usually the player or AI controller that owns the actor…
Okay thanks, I’ll see if that works!
Just don’t set the owner.
No actor owns the enemy.
@MostHost_LA @Limanima Game Crashes: Even if I set the Owner as GetAIController. Even if I set the GetPlayerPawn. Even if I don’t set any Owner.
“Game crahses” means nothing.
at a bare minimum you need to share an error message.
Probably install the debug symbols and cause the error again - so you can get a meaningful error.
Okay here you go.
Assertion failed: DelegateOwner->IsValidLowLevelFast(false) [File:D:\Program Files\Epic Games\UE_4.27\Engine\Source\Runtime\CoreUObject\Public\UObject/SparseDelegate.h] [Line: 196]
UE4Editor_Core
UE4Editor_Core
UE4Editor_Monster_Shooter_0015!AEnemy::BeginPlay() [D:\Game Development and Programming\Monster_Shooter\Source\Monster_Shooter\Enemy.cpp:48]
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Monster_Shooter_0015!AEnemy::Tick() [D:\Game Development and Programming\Monster_Shooter\Source\Monster_Shooter\Enemy.cpp:58]
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Core
UE4Editor_Core
UE4Editor_Core
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll
Whatever you are feeding into it is an NON valid variable.
So is there any way to fix this, or I have to find it?
Have you looked at any particular respawn tutorial?
Or are you just guessing what to do?
We have no idea what you are actually doing code or BP wise, so it’s near impossible to offer suggestions short of general things…
Like, try to validate the variable before use…
I am referring to this UE4 docs tutorial - Spawning and Destroying an Actor | Unreal Engine Documentation
Which part in there are you stuck on / where did the owner really come into play?
Also - where is this code?
Surely you aren’t expecting the actor to Spawn itself into existence?
Whenever I hit play after around 5 seconds the Game crashes showing that error message, basically when the Spawn Enemy function comes to play.
Doesn’t sound like you followed the tutorial.
I see nothing in there about owners at a glance.
At a base level.
Create an actor that manages spawning of units.
Create an array of classes. Populate the default values with however many entries you want to start to spawn.
Follow the tutorial to Spawn.
Use the array and a for loop to Spawn multiple.
Whenever a unit is destroyed, call an interface call to Spawn a new one.
Done.
Okay thanks I’ll try that.