Skip to content

Commit 4a959b8

Browse files
authored
Fix World.OnComponentSet (#299)
1 parent 5f60fad commit 4a959b8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Arch/Core/Events/World.Events.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,12 @@ public void OnComponentAdded(Entity entity, ComponentType compType)
325325
/// Calls all handlers subscribed to component setting of this type.
326326
/// </summary>
327327
/// <param name="entity">The entity that the component was set on.</param>
328-
/// <param name="comp">The component instance that got set.</param>
328+
/// <param name="compType">The type of component that got set.</param>
329329

330-
public void OnComponentSet(Entity entity, object comp)
330+
public void OnComponentSet(Entity entity, ComponentType compType)
331331
{
332332
#if EVENTS
333-
var events = GetEvents(comp.GetType());
333+
var events = GetEvents(compType);
334334
if (events == null)
335335
{
336336
return;

src/Arch/Core/World.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,7 @@ public void Set(Entity entity, object component)
12961296
{
12971297
var entitySlot = EntityInfo.GetEntityData(entity.Id);
12981298
entitySlot.Archetype.Set(ref entitySlot.Slot, component);
1299-
OnComponentSet(entity, component);
1299+
OnComponentSet(entity, (ComponentType)component.GetType());
13001300
}
13011301

13021302
/// <summary>
@@ -1311,7 +1311,7 @@ public void SetRange(Entity entity, Span<object> components)
13111311
foreach (var cmp in components)
13121312
{
13131313
entitySlot.Archetype.Set(ref entitySlot.Slot, cmp);
1314-
OnComponentSet(entity, cmp);
1314+
OnComponentSet(entity, (ComponentType)cmp.GetType());
13151315
}
13161316
}
13171317

0 commit comments

Comments
 (0)