Skip to content

Commit

Permalink
Cache now updates if script is different
Browse files Browse the repository at this point in the history
  • Loading branch information
WooshiiDev committed Sep 6, 2023
1 parent 30294af commit e9f7f77
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion HierarchyDecorator/Scripts/Editor/Data/Types/ComponentGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,18 @@ public void Update(ComponentType component, MonoScript script)
return;
}

// Remove old component cached

if (Contains(component))
{
lookup.Remove(component.Type);
}

// Update type and recache

component.UpdateType(script);

if (!lookup.ContainsKey(component.Type))
if (!Contains(component.Type))
{
lookup.Add(component.Type, component);
}
Expand Down Expand Up @@ -340,6 +349,11 @@ public bool Contains(ComponentType component)

public bool Contains(Type type)
{
if (hasCached && lookup.ContainsKey(type))
{
return true;
}

for (int i = 0; i < components.Count; i++)
{
if (components[i].Type == type)
Expand Down

0 comments on commit e9f7f77

Please sign in to comment.