Quantcast
Channel: Forum Pasja Informatyki - Najnowsze pytania bez odpowiedzi
Viewing all articles
Browse latest Browse all 21942

Wyskakuje błąd kompilacji, a IDE nic nie pokazuje [ue4]

$
0
0

Wykombinowałem taki kod:

.h:

UCLASS()
class MYPROJECT2_API AForestController : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AForestController();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	UPROPERTY(EditAnywhere)
		UStaticMeshComponent *mesh;

	UFUNCTION()
		void onCursorOver(UPrimitiveComponent *component);
	
	UFUNCTION()
		void endCursorOver(UPrimitiveComponent *component);
//	std::vector<UMeshComponent*> meshes;
};

.cpp

AForestController::AForestController()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
	//mesh->AttachTo(RootComponent);
}

// Called when the game starts or when spawned
void AForestController::BeginPlay()
{
	Super::BeginPlay();
}

// Called every frame
void AForestController::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );
	mesh->OnBeginCursorOver.AddDynamic(this, &onCursorOver);
}

void AForestController::onCursorOver(UPrimitiveComponent *component)
{
	GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, TEXT("WORK"));
}

void AForestController::endCursorOver(UPrimitiveComponent *component)
{
	GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, TEXT("WORK"));
}

 

Ale przy kompilacji wywala takie błędy:

 

'&': illegal operation on bound member function expression  26

'TBaseDynamicMulticastDelegate<FWeakObjectPtr,void,UPrimitiveComponent *>::__Internal_AddDynamic': no matching overloaded function found  26 

 'void TBaseDynamicMulticastDelegate<FWeakObjectPtr,void,UPrimitiveComponent *>::__Internal_AddDynamic(UserClass *,TBaseDynamicDelegate<FWeakObjectPtr,RetValType,UPrimitiveComponent *>::TMethodPtrResolver<UserClass>::FMethodPtr,FName)': expects 3 arguments - 2 provided   26    

 

W IDE nie podświetla niczego, że jest błąd, a funkcje onCursorOver jest dobra, gdyż wyświetla błąd, dopiero gdy ją zmienię

   

    

 


Viewing all articles
Browse latest Browse all 21942