Fronit
(Eric)
August 18, 2014, 2:46pm
1
Hi, when i try to run my project i get the following crash report:
e:\program files\unrealengine\4.4\engine\source\runtime\core\public\delegates\DelegateSignatureImpl.inl(2035): Ensure condition failed: this->IsBound()
Unable to bind delegate to '&UInteractiveActor::myBeginCursorOver' (function might not be marked as a UFUNCTION)
The file parent class is UActorComponent
The code:
.cpp
myActor = nullptr;
myActor = GetOwner();
if (myActor != nullptr)
{
myActor->OnBeginCursorOver.AddDynamic(this,&UInteractiveActor::myBeginCursorOver);
myActor->OnEndCursorOver.AddDynamic(this,&UInteractiveActor::myEndCursorOver);
}
.h
UFUNCTION()
void myBeginCursorOver();
UFUNCTION()
void myEndCursorOver();
// I have created the functions in the .cpp
Any idea why this isn’t working? This was working fine on the “test” project but not on the main.
Just a sanity check: Is the this pointer actually an UInteractiveActor , i.e. is the code you posted inside a UInteractiveActor member function?
The ensure triggers because the UFunction cannot be found on that object.
Fronit
(Eric)
August 19, 2014, 6:21pm
3
Yes it is, but now i am able to “run” my project without this error from time to time. So this error seems to occur randomly…
I read a similar post about this problem and the poster said he fixed it but didn’t tell how…
Hi,
Are you saying that the error occurs randomly on different runs of the same build, or randomly in that one build will consistently work and another build will consistently fail?
Are you trying to use this object across multiple threads?
Steve
Fronit
(Eric)
August 21, 2014, 9:26am
5
Right now i have tried with the same build, didn’t change anything in the game. I get the message UE4Editor.exe has triggered a breakpoint. I can choose to break it or to continue, if i press continue two times the game will run and i wont get this message back for a few “stop and run”
Steve_Robb
(Steve Robb)
August 28, 2014, 12:55pm
6
I think we need a more reproducible test case to help you with this problem. Can you repeat it in a brand new project and describe it here, please?
Steve
Katagena
(RousselFrederic)
November 4, 2014, 1:55am
7
Have you find a solution ? i’ve got the same problem i think
Fronit
(Eric)
November 4, 2014, 8:41am
8
No, but i commented out the assert line so it gives me no message now.
Katagena
(RousselFrederic)
November 4, 2014, 11:11am
9
I’ve got the exact same probleme (random exception + if i click continue two times it’s ok) with this code (i begin with UE4 and C++ maybe i did something wrong)
AKeyWall::AKeyWall(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
// Creation du mesh
mesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("MeshComp"));
ConstructorHelpers::FObjectFinder<UStaticMesh> staticMesh(TEXT("StaticMesh'/Game/Meshes/SM_WallKey'"));
mesh->SetStaticMesh(staticMesh.Object);
//Recuperation du material
ConstructorHelpers::FObjectFinder<UMaterial> MatFinder(TEXT("Material'/Game/Materials/Default/M_Tron_Default.M_Tron_Default'"));
UMaterial* Material = MatFinder.Object;
MaterialInstance = UMaterialInstanceDynamic::Create(Material, this);
FVector SpawnVector;
SpawnVector.X = FMath::FRandRange(0, 1);
SpawnVector.Y = FMath::FRandRange(0, 1);
SpawnVector.Z = FMath::FRandRange(0, 1);
MaterialInstance->SetVectorParameterValue(TEXT("PrimaryColor"), SpawnVector);
mesh->SetMaterial(0, MaterialInstance);
//Gestion du son
AudioComp = PCIP.CreateDefaultSubobject<UAudioComponent>(this, TEXT("AudioComp"));
int soundNumber = FMath::RandRange(1, 10);
FString soundPath = "/Game/Sound/" + FString::FromInt(soundNumber) + "." + FString::FromInt(soundNumber);
ConstructorHelpers::FObjectFinder<USoundWave> Sound(*soundPath);
AudioComp->SetSound(Sound.Object);
AudioComp->bAutoActivate = false;
//Gestion collision
mesh->SetNotifyRigidBodyCollision(true);
mesh->BodyInstance.SetCollisionProfileName(UCollisionProfile::PhysicsActor_ProfileName);
mesh->OnComponentHit.AddDynamic(this, &AKeyWall::OnHit);
//Declaration du root de l'actor
RootComponent = mesh;
}
void AKeyWall::OnHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit){
this->AudioComp->SetPitchMultiplier(2 - OtherActor->GetActorScale().X);
MaterialInstance->SetScalarParameterValue(TEXT("Power"), 100);
AudioComp->Activate(true);
AudioComp->Play(0.0f);
}
UCLASS()
class TESTCPP_API AKeyWall : public AActor
{
GENERATED_UCLASS_BODY()
UPROPERTY(VisibleDefaultsOnly, Category = Mesh)
TSubobjectPtr<UStaticMeshComponent> mesh;
UPROPERTY(VisibleDefaultsOnly, Category = Material)
UMaterialInstanceDynamic* MaterialInstance;
UPROPERTY(VisibleDefaultsOnly, Category = Sound)
TSubobjectPtr <UAudioComponent> AudioComp;
bool isLighted = false;
protected:
UFUNCTION()
virtual void OnHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
};
Don’t know if this could help…
Fronit
(Eric)
November 4, 2014, 11:33am
10
I will try to replicate it when i get home.
Steve_Robb
(Steve Robb)
November 4, 2014, 11:07am
11
My comment above still applies… can you please reproduce the problem in a brand new project so that I have a chance at replicating it here, please?
Steve
Fronit
(Eric)
November 4, 2014, 3:31pm
12
Ok follow these steps:
create a new First Person Shooter Project(BP)
Add Code To Project → Add Actor component
Close down Unreal 4 and open up the project in visual Studio
Add code
Cpp File
UMyActorComponent::UMyActorComponent(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
myActor = nullptr;
myActor = GetOwner();
if (myActor)
{
myActor->OnBeginCursorOver.AddUniqueDynamic(this, &UMyActorComponent::myBeginCursorOver);
myActor->OnEndCursorOver.AddUniqueDynamic(this, &UMyActorComponent::myEndCursorOver);
myActor->OnClicked.AddUniqueDynamic(this, &UMyActorComponent::myOnClicked);
}
}
void UMyActorComponent::myOnClicked(){
}
void UMyActorComponent::myBeginCursorOver(){
}
void UMyActorComponent::myEndCursorOver(){
}
Header File
UCLASS(meta = (BlueprintSpawnableComponent))
class MYPROJECT_API UMyActorComponent : public UActorComponent
{
GENERATED_UCLASS_BODY()
UPROPERTY()
AActor *myActor;
UFUNCTION()
void myBeginCursorOver();
UFUNCTION()
void myEndCursorOver();
UFUNCTION()
void myOnClicked();
};
5 Press F5 in Visual Studio , once unreal 4 have loaded make a blueprint with a static mesh component and also add “MyActorComponent” , spawn 2 of these blueprints and play the game assert will come up here
Fronit
(Eric)
November 24, 2014, 6:35pm
13
Were you able to reconstruct it?