fail to use DELEGATE

Hi all,

Im trying to use DELEGATE in my Tetris game in order to use my Cube blueprint everytime a cube is moved (c++ function called) to use Timeline blueprint node.

But unfortunately it doesn’t work.

Here is my Cube.h :

#pragma once

#include "GameFramework/Pawn.h"
#include "Cube.generated.h"


class TETRIS6_API ACube : public APawn

	// Sets default values for this pawn's properties

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

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;

	void Move();

	FOnMoveCubeRequest OnMoveCubeRequest;

Cube.cpp :

void ACube::Move() {



And in my Cube blueprint i have :

And nothing is printed at run time.

What should i do please ?

Where do you actually call Move() in your C++ code??

Hi, i call Move() from another class :

void ATetrisPlayerController::SpinCubes(){ 


	for (int32 i = 0; i < 4; i++) {


And i call SpinCubes from a keyboard event, no worry it is called.

If you put a breakpoint inside SpintCubes() and run your game can you check that it actually gets into your for loop at all?
My guess is that it might not.

I just put a UE_LOG() and my game gets into my for loop.

Did you actually bind your function in the Blueprint to the OnMoveCubeRequest multicast delegate?

Then the next issue is that you didn’t actually bind the event of your component but just a custom event.

Try and right click the component on the blueprint and choose “Add Event”.

I left c++ code as it was, and in my Cube blueprint i did that :

And it still doesn’t print anything at run time.

Your event is called “Custom Event” as a subtitle.
That to me says it’s not a Move Event but a custom event you made. Try and right click the component you made and press “Add Event”

which component ?

The one using your Move() event.

I don’t understand, because DELEGATE is a new concept to me, you are talking about which node ? From left to right in the picture, the first one, the second one, or the third one ?

Okay let me show you a setup I got, which uses a delegate like you try to do. I have a Component that I made called “Use”. When I put that component on a blueprint it adds a Use Event to it so that I can interact with the environment. It looks like this:


Notice that the OnUse(Use) event does not have “Custom Event” underneath it. This is because it’s my Component “Use” event and not just some custom event.
The way I can call it is to Right-Click my Use Component and choose “Add Event”. Then click “OnUse”. It will add it to the blueprint for me.


Thanks for you help but i don’t have any component in my Cube blueprint. Anyway i found the solution :

Now the string is printed on run time

Show me the components list out to the left of your blueprint please.

Oh my bad, i have only a static mesh component, and if i right click on it i can add event. I have learned another thing today thanks