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"
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnMoveCubeRequest);
UCLASS()
class TETRIS6_API ACube : public APawn
{
GENERATED_BODY()
public:
// Sets default values for this pawn's properties
ACube();
// 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();
UPROPERTY(BlueprintAssignable)
FOnMoveCubeRequest OnMoveCubeRequest;
};
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.
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”
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.