From da8c72d9aa9f041f7dd9dc16aefa040a88a323e0 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Tue, 23 Aug 2022 09:24:42 -0400 Subject: [PATCH] handle reserved property names of entities --- .../Scripts/BeatmapFormats/DynamicBeatmap.cs | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs b/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs index 171e6c69..727ab4c1 100644 --- a/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs +++ b/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs @@ -125,14 +125,23 @@ namespace HeavenStudio } set { - if (DynamicData.ContainsKey(propertyName)) + switch (propertyName) { - DynamicData[propertyName] = value; - } - else - { - UnityEngine.Debug.LogError($"This entity does not have a property named {propertyName}! Attempted to insert value of type {value.GetType()}"); + case "beat": + case "track": + case "length": + case "swing": + case "datamodel": + UnityEngine.Debug.LogWarning($"Property name {propertyName} is reserved and cannot be set."); + break; + default: + if (DynamicData.ContainsKey(propertyName)) + DynamicData[propertyName] = value; + else + UnityEngine.Debug.LogError($"This entity does not have a property named {propertyName}! Attempted to insert value of type {value.GetType()}"); + break; } + } }