why my ENUM only accept 54 elements in Unreal engine?

I have the below ENUM in my code but the last element (55th) does not show up in the blueprint.

if I move the last element higher, then the new last element will not show up.
if I remove the last element so 54 elements remain, then all the elements will show up in blueprint.

so it seems, that UE Enum only accept 54 element yet it should accept 255 element logically. does any one knows that what is wrong?
Version: UE5.2.1

UENUM(BlueprintType)
enum EScoringParameter {
	en_SpeedingViolationCount						UMETA(DisplayName = "Speeding Violation"),
	en_GearChangeCount								UMETA(DisplayName = "Number of Gear Change"),
	en_BadGearChangeToNeutralCount					UMETA(DisplayName = "Gear Changed Without Clutchto Neutral"),
	en_BadGearChangeInEngineOnCount					UMETA(DisplayName = "Gear Changed Without Clutch Engine On"),
	en_BadGearChangeInEngineOffCount				UMETA(DisplayName = "Gear Changed Without Clutch Engine Off"),
	en_WrongGearChangeCount							UMETA(DisplayName = "Wrong Sequence in Gear Change"),
	en_EngineShutdownInMotionCount					UMETA(DisplayName = "Engine Shutdown in Motion"),
	en_EngineShutdownInStationCount					UMETA(DisplayName = "Engine Shutdown in Station"),
	en_SeatBeltNotFastendBeforeEngineStartCount		UMETA(DisplayName = "Seat Belt Not Fastend Before Engine Start"),
	en_BadTurnONCount								UMETA(DisplayName = "Bad Turn ON"),
	en_HandbrakeNotReleasedCount					UMETA(DisplayName = "Handbrake Not Released"),
	en_TurnSignalNotUsedCount						UMETA(DisplayName = "Turn Signal Not Used"),
	en_ThrottlingInNeutralGearCount					UMETA(DisplayName = "Throttling in Neutral Gear"),
	en_CollisionWithCars							UMETA(DisplayName = "Collision With Cars"),
	en_CollisionWithPedestrians						UMETA(DisplayName = "Collision With People"),
	en_CollisionWithOther							UMETA(DisplayName = "Collision With Other"),
	en_RedLightRunCount								UMETA(DisplayName = "Red Light Run"),
	en_TotalFrequentHornCount						UMETA(DisplayName = "Frequent Horn"),
	en_TotalContinuousHornCount						UMETA(DisplayName = "Continuous Horn"),
	en_OffLightInDarkConditionCount					UMETA(DisplayName = "Lights Off In the Dark"),
	en_TotalBlindedRoadUsersCount					UMETA(DisplayName = "Number of Blinded By Light"),
	en_LongitudinalAccelerationDiscomfortCount		UMETA(DisplayName = "Lng. Accel. Discomfort"),
	en_LateralAccelerationDiscomfortLowCount		UMETA(DisplayName = "Lat. Accel. Discomfort Low"),
	en_LateralAccelerationDiscomfortMediumCount		UMETA(DisplayName = "Lat. Accel. Discomfort Medium"),
	en_LateralAccelerationDiscomfortExtremeCount	UMETA(DisplayName = "Lat. Accel. Discomfort Extreme"),
	en_LongitudinalJerkDiscomfortCount				UMETA(DisplayName = "Lng. Jerk Discomfort"),
	en_LateralJerkDiscomfortCount					UMETA(DisplayName = "Lat. Jerk Discomfort"),
	en_DeviationToRightLaneCount					UMETA(DisplayName = "Deviate to Right Lane"),
	en_DeviationToLeftLaneCount						UMETA(DisplayName = "Deviate to Left Lane"),
	en_DeviationToShoulderCount						UMETA(DisplayName = "Deviate to Shoulder"),
	en_DeviationToOppositeLaneCount					UMETA(DisplayName = "Deviate to Opposite Lane"),
	en_ChangeLaneToRightWithoutIndicatorCount		UMETA(DisplayName = "Change Lane to Right"),
	en_ChangeLaneToLeftWithoutIndicatorCount		UMETA(DisplayName = "Change Lane to Left"),
	en_DeviationFromShoulderToRoadCount				UMETA(DisplayName = "Deviate from Shoulder to Road"),
	en_OutOfRoadCount								UMETA(DisplayName = "Out of Road"),
	en_DeviationFromShoulderToRoadOppositeCount		UMETA(DisplayName = "Deviate from Shoulder to Road Opposite"),
	en_OutOfRoadOppositeCount						UMETA(DisplayName = "Out of Road Opposite"),
	en_EnteringRoadWithoutIndicatorCount			UMETA(DisplayName = "Enter Road"),
	en_DrivingToShoulderWithoutIndicatorCount		UMETA(DisplayName = "Drive to Shoulder"),
	en_EnteringRoadOppositeCount					UMETA(DisplayName = "Enter Road Opposite"),
	en_DrivingRoadOppositeCount						UMETA(DisplayName = "Drive Road Opposite"),
	en_DeviationToSidewalkParallelCount				UMETA(DisplayName = "Deviate to Sidewalk Parallel"),
	en_DeviationToOutOfRoadParallelCount			UMETA(DisplayName = "Deviate to Out of Road Parallel"),
	en_EnteringSidewalkParallelCount				UMETA(DisplayName = "Enter Sidewalk Parallel"),
	en_DeviationToSidewalkOppositeCount				UMETA(DisplayName = "Deviate to Sidewalk Opposite"),
	en_DeviationToOutOfRoadOppositeCount			UMETA(DisplayName = "Deviate to Out of Road Opposite"),
	en_EnteringSidewalkOppositeCount				UMETA(DisplayName = "Enter Sidewalk Opposite"),
	en_NoRightTurnViolationCount					UMETA(DisplayName = "No Right Turn Violation"),
	en_NoLeftTurnViolationCount						UMETA(DisplayName = "No Left Turn Violation"),
	en_NoPassingViolationCount						UMETA(DisplayName = "No Passing Violation"),
	en_StopViolationCount							UMETA(DisplayName = "Stop Violation"),
	en_NoStopingViolationCount						UMETA(DisplayName = "No Stoping Violation"),
	en_NoEntryViolationCount						UMETA(DisplayName = "No Entry Violation"),
	en_NoHornViolationCount							UMETA(DisplayName = "No Horn Violation"),
	en_NoLocalSpeedingViolationCount				UMETA(DisplayName = "No Local Speeding Violation")

};

I think the ENUM does support more than 54 elements. The problem is that the UI won’t show you all of the 255. I suggest looking at a Data Table once you get to a certain number of entries. Alternatively, If you have more than 54 related elements, consider grouping them into smaller sub-enums.

1 Like

Thank you. But it not probably a UI problem because I copied the ENUM into a new project and there everything worked fine. It sounds like that our code is triggering an engine bug some how.

Also, Data table does not suit our purpose. We can use an array of strings yet its not efficient. We can use a byte variable but its not readable.

Compiles no problem.

In your header file just make sure to define it as

	UPROPERTY(BlueprintReadWrite,EditAnywhere)	
	TEnumAsByte<EScoringParameter> EScoringParameter;

Even added one more for a test and it shows up fine.
Tested in 5.3.2 , works in 5.2.1 too.

Last enum entry

last

2 Likes

Thank you. but doing this:

	UPROPERTY(BlueprintReadWrite,EditAnywhere)	
	TEnumAsByte<EScoringParameter> EScoringParameter;

Gives me compile errors because they have the same name. Changing the name also did not fix the bug. Also we don’t use that enum to create a variable. It’s one of the inputs of such a global setter:

void AMyPlayerState::SetScoringParameterValue(const enum EScoringParameter ScoringTarget, bool PluseOne, int Value)
{
	if (ScoringWarning.IsBound())
	{
		ScoringWarning.Broadcast(ScoringTarget);
	}
	switch (ScoringTarget)
	{
	case EScoringParameter::en_SpeedingViolationCount:
		if (PluseOne) {
			SpeedingViolationCount = SpeedingViolationCount + 1;
		}
		else {
			SpeedingViolationCount = Value;
		}
		break;
	case EScoringParameter::en_GearChangeCount:
		if (PluseOne) {
			GearChangeCount = GearChangeCount + 1;
		}
		else {
			GearChangeCount = Value;
		}
		break;
	case EScoringParameter::en_BadGearChangeToNeutralCount:
		if (PluseOne) {
			BadGearChangeToNeutralCount = BadGearChangeToNeutralCount + 1;
		}
		else {
			BadGearChangeToNeutralCount = Value;
		}
		break;
	case EScoringParameter::en_BadGearChangeInEngineOnCount:
		if (PluseOne) {
			BadGearChangeInEngineOnCount = BadGearChangeInEngineOnCount + 1;
		}
		else {
			BadGearChangeInEngineOnCount = Value;
		}
		break;
	case EScoringParameter::en_BadGearChangeInEngineOffCount:
		if (PluseOne) {
			BadGearChangeInEngineOffCount = BadGearChangeInEngineOffCount + 1;
		}
		else {
			BadGearChangeInEngineOffCount = Value;
		}
		break;
	case EScoringParameter::en_WrongGearChangeCount:
		if (PluseOne) {
			WrongGearChangeCount = WrongGearChangeCount + 1;
		}
		else {
			WrongGearChangeCount = Value;
		}
		break;
	case EScoringParameter::en_EngineShutdownInMotionCount:
		if (PluseOne) {
			EngineShutdownInMotionCount = EngineShutdownInMotionCount + 1;
		}
		else {
			EngineShutdownInMotionCount = Value;
		}
		break;
	case EScoringParameter::en_EngineShutdownInStationCount:
		if (PluseOne) {
			EngineShutdownInStationCount = EngineShutdownInStationCount + 1;
		}
		else {
			EngineShutdownInStationCount = Value;
		}
		break;
	case EScoringParameter::en_SeatBeltNotFastendBeforeEngineStartCount:
		if (PluseOne) {
			SeatBeltNotFastendBeforeEngineStartCount = SeatBeltNotFastendBeforeEngineStartCount + 1;
		}
		else {
			SeatBeltNotFastendBeforeEngineStartCount = Value;
		}
		break;
	case EScoringParameter::en_BadTurnONCount:
		if (PluseOne) {
			BadTurnOnCount = BadTurnOnCount + 1;
		}
		else {
			BadTurnOnCount = Value;
		}
		break;
	case EScoringParameter::en_HandbrakeNotReleasedCount:
		if (PluseOne) {
			HandbrakeNotReleasedCount = HandbrakeNotReleasedCount + 1;
		}
		else {
			HandbrakeNotReleasedCount = Value;
		}
		break;
	case EScoringParameter::en_TurnSignalNotUsedCount:
		if (PluseOne) {
			TurnSignalNotUsedCount = TurnSignalNotUsedCount + 1;
		}
		else {
			TurnSignalNotUsedCount = Value;
		}
		break;
	case EScoringParameter::en_ThrottlingInNeutralGearCount:
		if (PluseOne) {
			ThrottlingInNeutralGearCount = ThrottlingInNeutralGearCount + 1;
		}
		else {
			ThrottlingInNeutralGearCount = Value;
		}
		break;
	case EScoringParameter::en_CollisionWithCars:
		if (PluseOne) {
			CollisionCarsCount = CollisionCarsCount + 1;
		}
		else {
			CollisionCarsCount = Value;
		}
		break;
	case EScoringParameter::en_CollisionWithPedestrians:
		if (PluseOne) {
			CollisionPedestriansCount = CollisionPedestriansCount + 1;
		}
		else {
			CollisionPedestriansCount = Value;
		}
		break;
	case EScoringParameter::en_CollisionWithOther:
		if (PluseOne) {
			CollisionOtherCount = CollisionOtherCount + 1;
		}
		else {
			CollisionOtherCount = Value;
		}
		break;
	case EScoringParameter::en_RedLightRunCount:
		if (PluseOne) {
			RedLightRunCount = RedLightRunCount + 1;
		}
		else {
			RedLightRunCount = Value;
		}
		break;
	case EScoringParameter::en_TotalFrequentHornCount:
		if (PluseOne) {
			TotalFrequentHornCount = TotalFrequentHornCount + 1;
		}
		else {
			TotalFrequentHornCount = Value;
		}
		break;
	case EScoringParameter::en_TotalContinuousHornCount:
		if (PluseOne) {
			TotalContinuousHornCount = TotalContinuousHornCount + 1;
		}
		else {
			TotalContinuousHornCount = Value;
		}
		break;
	case EScoringParameter::en_OffLightInDarkConditionCount:
		if (PluseOne) {
			OffLightInDarkConditionCount = OffLightInDarkConditionCount + 1;
		}
		else {
			OffLightInDarkConditionCount = Value;
		}
		break;
	case EScoringParameter::en_TotalBlindedRoadUsersCount:
		if (PluseOne) {
			TotalBlindedRoadUsersCount = TotalBlindedRoadUsersCount + 1;
		}
		else {
			TotalBlindedRoadUsersCount = Value;
		}
		break;
	case EScoringParameter::en_LongitudinalAccelerationDiscomfortCount:
		if (PluseOne) {
			LongitudinalAccelerationDiscomfortCount = LongitudinalAccelerationDiscomfortCount + 1;
		}
		else {
			LongitudinalAccelerationDiscomfortCount = Value;
		}
		break;
	case EScoringParameter::en_LateralAccelerationDiscomfortLowCount:
		if (PluseOne) {
			LateralAccelerationDiscomfortLowCount = LateralAccelerationDiscomfortLowCount + 1;
		}
		else {
			LateralAccelerationDiscomfortLowCount = Value;
		}
		break;
	case EScoringParameter::en_LateralAccelerationDiscomfortMediumCount:
		if (PluseOne) {
			LateralAccelerationDiscomfortMediumCount = LateralAccelerationDiscomfortMediumCount + 1;
		}
		else {
			LateralAccelerationDiscomfortMediumCount = Value;
		}
		break;
	case EScoringParameter::en_LateralAccelerationDiscomfortExtremeCount:
		if (PluseOne) {
			LateralAccelerationDiscomfortExtremeCount = LateralAccelerationDiscomfortExtremeCount + 1;
		}
		else {
			LateralAccelerationDiscomfortExtremeCount = Value;
		}
		break;
	case EScoringParameter::en_LongitudinalJerkDiscomfortCount:
		if (PluseOne) {
			LongitudinalJerkDiscomfortCount = LongitudinalJerkDiscomfortCount + 1;
		}
		else {
			LongitudinalJerkDiscomfortCount = Value;
		}
		break;
	case EScoringParameter::en_LateralJerkDiscomfortCount:
		if (PluseOne) {
			LateralJerkDiscomfortCount = LateralJerkDiscomfortCount + 1;
		}
		else {
			LateralJerkDiscomfortCount = Value;
		}
		break;
	case EScoringParameter::en_DeviationToRightLaneCount:
		if (PluseOne) {
			DeviationToRightLaneCount = DeviationToRightLaneCount + 1;
		}
		else {
			DeviationToRightLaneCount = Value;
		}
		break;
	case EScoringParameter::en_DeviationToLeftLaneCount:
		if (PluseOne) {
			DeviationToLeftLaneCount = DeviationToLeftLaneCount + 1;
		}
		else {
			DeviationToLeftLaneCount = Value;
		}
		break;
	case EScoringParameter::en_DeviationToShoulderCount:
		if (PluseOne) {
			DeviationToShoulderCount = DeviationToShoulderCount + 1;
		}
		else {
			DeviationToShoulderCount = Value;
		}
		break;
	case EScoringParameter::en_DeviationToOppositeLaneCount:
		if (PluseOne) {
			DeviationToOppositeLaneCount = DeviationToOppositeLaneCount + 1;
		}
		else {
			DeviationToOppositeLaneCount = Value;
		}
		break;
	case EScoringParameter::en_ChangeLaneToRightWithoutIndicatorCount:
		if (PluseOne) {
			ChangeLaneToRightWithoutIndicatorCount = ChangeLaneToRightWithoutIndicatorCount + 1;
		}
		else {
			ChangeLaneToRightWithoutIndicatorCount = Value;
		}
		break;
	case EScoringParameter::en_ChangeLaneToLeftWithoutIndicatorCount:
		if (PluseOne) {
			ChangeLaneToLeftWithoutIndicatorCount = ChangeLaneToLeftWithoutIndicatorCount + 1;
		}
		else {
			ChangeLaneToLeftWithoutIndicatorCount = Value;
		}
		break;
	case EScoringParameter::en_DeviationFromShoulderToRoadCount:
		if (PluseOne) {
			DeviationFromShoulderToRoadCount = DeviationFromShoulderToRoadCount + 1;
		}
		else {
			DeviationFromShoulderToRoadCount = Value;
		}
		break;
	case EScoringParameter::en_OutOfRoadCount:
		if (PluseOne) {
			OutOfRoadCount = OutOfRoadCount + 1;
		}
		else {
			OutOfRoadCount = Value;
		}
		break;
	case EScoringParameter::en_DeviationFromShoulderToRoadOppositeCount:
		if (PluseOne) {
			DeviationFromShoulderToRoadOppositeCount = DeviationFromShoulderToRoadOppositeCount + 1;
		}
		else {
			DeviationFromShoulderToRoadOppositeCount = Value;
		}
		break;
	case EScoringParameter::en_OutOfRoadOppositeCount:
		if (PluseOne) {
			OutOfRoadOppositeCount = OutOfRoadOppositeCount + 1;
		}
		else {
			OutOfRoadOppositeCount = Value;
		}
		break;
	case EScoringParameter::en_EnteringRoadWithoutIndicatorCount:
		if (PluseOne) {
			EnteringRoadWithoutIndicatorCount = EnteringRoadWithoutIndicatorCount + 1;
		}
		else {
			EnteringRoadWithoutIndicatorCount = Value;
		}
		break;
	case EScoringParameter::en_DrivingToShoulderWithoutIndicatorCount:
		if (PluseOne) {
			DrivingToShoulderWithoutIndicatorCount = DrivingToShoulderWithoutIndicatorCount + 1;
		}
		else {
			DrivingToShoulderWithoutIndicatorCount = Value;
		}
		break;
	case EScoringParameter::en_EnteringRoadOppositeCount:
		if (PluseOne) {
			EnteringRoadOppositeCount = EnteringRoadOppositeCount + 1;
		}
		else {
			EnteringRoadOppositeCount = Value;
		}
		break;
	case EScoringParameter::en_DrivingRoadOppositeCount:
		if (PluseOne) {
			DrivingRoadOppositeCount = DrivingRoadOppositeCount + 1;
		}
		else {
			DrivingRoadOppositeCount = Value;
		}
		break;
	case EScoringParameter::en_DeviationToSidewalkParallelCount:
		if (PluseOne) {
			DeviationToSidewalkParallelCount = DeviationToSidewalkParallelCount + 1;
		}
		else {
			DeviationToSidewalkParallelCount = Value;
		}
		break;
	case EScoringParameter::en_DeviationToOutOfRoadParallelCount:
		if (PluseOne) {
			DeviationToOutOfRoadParallelCount = DeviationToOutOfRoadParallelCount + 1;
		}
		else {
			DeviationToOutOfRoadParallelCount = Value;
		}
		break;
	case EScoringParameter::en_EnteringSidewalkParallelCount:
		if (PluseOne) {
			EnteringSidewalkParallelCount = EnteringSidewalkParallelCount + 1;
		}
		else {
			EnteringSidewalkParallelCount = Value;
		}
		break;
	case EScoringParameter::en_DeviationToSidewalkOppositeCount:
		if (PluseOne) {
			DeviationToSidewalkOppositeCount = DeviationToSidewalkOppositeCount + 1;
		}
		else {
			DeviationToSidewalkOppositeCount = Value;
		}
		break;
	case EScoringParameter::en_DeviationToOutOfRoadOppositeCount:
		if (PluseOne) {
			DeviationToOutOfRoadOppositeCount = DeviationToOutOfRoadOppositeCount + 1;
		}
		else {
			DeviationToOutOfRoadOppositeCount = Value;
		}
		break;
	case EScoringParameter::en_EnteringSidewalkOppositeCount:
		if (PluseOne) {
			EnteringSidewalkOppositeCount = EnteringSidewalkOppositeCount + 1;
		}
		else {
			EnteringSidewalkOppositeCount = Value;
		}
		break;
	case EScoringParameter::en_NoRightTurnViolationCount:
		if (PluseOne) {
			NoRightTurnViolationCount = NoRightTurnViolationCount + 1;
		}
		else {
			NoRightTurnViolationCount = Value;
		}
		break;
	case EScoringParameter::en_NoLeftTurnViolationCount:
		if (PluseOne) {
			NoLeftTurnViolationCount = NoLeftTurnViolationCount + 1;
		}
		else {
			NoLeftTurnViolationCount = Value;
		}
		break;
	case EScoringParameter::en_NoPassingViolationCount:
		if (PluseOne) {
			NoPassingViolationCount = NoPassingViolationCount + 1;
		}
		else {
			NoPassingViolationCount = Value;
		}
		break;
	case EScoringParameter::en_StopViolationCount:
		if (PluseOne) {
			StopViolationCount = StopViolationCount + 1;
		}
		else {
			StopViolationCount = Value;
		}
		break;
	case EScoringParameter::en_NoStopingViolationCount:
		if (PluseOne) {
			NoStopingViolationCount = NoStopingViolationCount + 1;
		}
		else {
			NoStopingViolationCount = Value;
		}
		break;
	case EScoringParameter::en_NoEntryViolationCount:
		if (PluseOne) {
			NoEntryViolationCount = NoEntryViolationCount + 1;
		}
		else {
			NoEntryViolationCount = Value;
		}
		break;
	case EScoringParameter::en_NoHornViolationCount:
		if (PluseOne) {
			NoHornViolationCount = NoHornViolationCount + 1;
		}
		else {
			NoHornViolationCount = Value;
		}
		break;
	case EScoringParameter::en_NoLocalSpeedingViolationCount:
		if (PluseOne) {
			NoLocalSpeedingViolationCount = NoLocalSpeedingViolationCount + 1;
		}
		else {
			NoLocalSpeedingViolationCount = Value;
		}
		break;
	default:
		break;
	}
}

Oh boy this is a pretty bad design choice. You really should at this point either use a DataTable or a TMap of structs to drive the logic.

Not to mention making any changes down the line will be a headache.

1 Like

Well… if you could see the other cods, you would know that this is a good one :grinning:

Any way, when you say use DataTable or TMap i could only imagine something like this:

TMap<FString, &Float> ScoringParameter;
ScoringParameter.Add("SpeedingViolationCount", SpeedingViolationCount);
ScoringParameter.Add("GearChangeCount", GearChangeCount);
.
.
.

void AMyPlayerState::SetScoringParameterValue(const FString ScoringTarget, bool PluseOne, int Value)
{
    float& temp = ScoringParameter.Find(ScoringTarget)
    if (PluseOne) 
    {
		temp= temp + 1;
	}
	else
    {
        temp = Value;		
    }
}

but this way every time we should search for an FString key. so it does not feel efficient compared to the enum version.

I’m confused. Why are you incrementing or setting variables with an enum in the first place? Why not just set them directly?

1 Like

Because we want to Broadcast in the case of change in any of these variables.

void AMyPlayerState::SetScoringParameterValue(const enum EScoringParameter ScoringTarget, bool PluseOne, int Value)
{
	if (ScoringWarning.IsBound())
	{
		ScoringWarning.Broadcast(ScoringTarget);
	}

Ok, so you want something similar to the mediator pattern, but for variable state changes.

Something like this might work better and is in line with what the others are saying:

.h

#pragma once

#include "CoreMinimal.h"
#include "MyFloatDelegate.generated.h"

UENUM(BlueprintType)
enum class EScoringParameter : uint8
{
    Variable1 UMETA(DisplayName = "Variable1"),
    Variable2 UMETA(DisplayName = "Variable2"),
    Variable3 UMETA(DisplayName = "Variable3")
    // Add more variables here as needed
};

DECLARE_DELEGATE_TwoParams(FMyFloatDelegate, EScoringParameter, float);

UCLASS()
class YOURPROJECT_API UMyFloatDelegate : public UObject
{
    GENERATED_BODY()

public:
    UMyFloatDelegate();

    void SetFloatValue(EScoringParameter Parameter, float NewValue);

    float GetFloatValue(EScoringParameter Parameter) const;

    FMyFloatDelegate OnFloatValueChanged;

private:
    // Map to store float variables
    TMap<EScoringParameter, float> FloatVariables;
};

.cpp

#include "MyFloatDelegate.h"

UMyFloatDelegate::UMyFloatDelegate()
{
}

void UMyFloatDelegate::SetupMap()
{
    // Clear the map if needed
    FloatVariables.Empty();
   
    FloatVariables.Add(EScoringParameter::Variable1, 0.0f);
    FloatVariables.Add(EScoringParameter::Variable2, 0.0f);
    FloatVariables.Add(EScoringParameter::Variable3, 0.0f);
}

void UMyFloatDelegate::SetFloatValue(EScoringParameter Parameter, float NewValue)
{
    float* VariableValue = FloatVariables.Find(Parameter);
    if (VariableValue)
    {
        if (*VariableValue != NewValue)
        {
            *VariableValue = NewValue;
            OnFloatValueChanged.ExecuteIfBound(Parameter, NewValue);
        }
    }
    else
    {
        FloatVariables.Add(Parameter, NewValue);
        OnFloatValueChanged.ExecuteIfBound(Parameter, NewValue);
    }
}

float UMyFloatDelegate::GetFloatValue(EScoringParameter Parameter) const
{
    const float* VariableValue = FloatVariables.Find(Parameter);
    if (VariableValue)
    {
        return *VariableValue;
    }
    return 0.0f; // Return default value if the variable doesn't exist
}

Basically, add the enums and float values to a TMap, and then fire a delegate when something changes. This uses much less code.

1 Like

I really appreciate your solution but the main problem still remains. my enum will not show more that 54 element. and still need to add an 55th element.

This is really weird.
I copied the enum and renamed it a little bit in the same class of same project and the new one works fine.
But what ever I do to the old one it still does not show the 55th element.
I commented every thing that used the enum including the setter function and the delegate. deleted binary, intermediate, save, vs files from project and rebuild it yet it still do not show the 55th element!

Sounds like your blueprint has been corrupted. Maybe try remaking the blueprint?

1 Like

No it is persistent among all blueprints.
Also, I should mention that the enum is defined on a C++ player sate class and all blueprint classes are showing it wrong.

Thank you every body.
Finally, I managed to the fix the problem by renaming all of the elements of the broken enum.