Unrecognized type "SomeVariable"

Hello everyone, I would like to ask a question about a problem that I have encountered. Here it is :
I declared an delegate (just like as the unreal documents says how to declare) but unreal engine does not recognize the delegate. I mean it see and don’t see at the same tame. I can use every property and function of the delegate in the code itself(without and error or red things) but when I compile it unreal gives an error. Here is the photos of the code that causes the error and the compile error.



This code were working until I changed the location of two structures that I have defined in some folder to new folder. I did include the new file to the file but it didn’t make any difference.
Here is the file that I have just mentioned above

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Engine/ObjectLibrary.h"
#include "StructureLibrary.generated.h"


USTRUCT()
struct FDoOnce
{
	GENERATED_BODY()

public:

	FORCEINLINE bool Do()
	{
		if (!bHasBeenInited)
		{
			bHasBeenInited = true;
			return true;
		}
		return false;
	}

	FORCEINLINE void Reset() { bHasBeenInited = false; }

private:

	UPROPERTY()
		bool bHasBeenInited = false;

};

USTRUCT()
struct FGate
{
	GENERATED_BODY()

public:

	FORCEINLINE bool CanPassThrough() { return bIsGateOpen ? true : false; }
	FORCEINLINE void OpenGate() { bIsGateOpen = true; }
	FORCEINLINE void CloseGate() { bIsGateOpen = false; }

private:

	UPROPERTY()
		bool bIsGateOpen = false;
};


/**
 * 
 */
UCLASS()
class CDC_API UStructureLibrary : public UObjectLibrary
{
	GENERATED_BODY()
	
};

Try removing UDELEGATE() from your declarations

I think you mean to use this syntax:

DECLARE_DYNAMIC_MULTICAST_DELEGATE(FInitCharacterDelegate);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FHealthChangeDelegate, float, OldHealth);

Also don’t do this inside of the class declaration, do it above it

1 Like

I just removed UPROPERTY() macro from my delegates and it fixed the compile error but a new one showed up and it says that “Unrecoginzed token following UDELEGATE()”. I solved it too and to do this I needed to remove UDELGATE from my declerations as you said.