Skip to content

Commit

Permalink
Merge pull request #304 from stride3d/master
Browse files Browse the repository at this point in the history
Initiating deployment of latest docs updates to staging
  • Loading branch information
VaclavElias authored Jun 19, 2024
2 parents 1c9db4a + c5f38d6 commit c8136eb
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The main difference compared to [`EntityProcessor`](xref:Stride.Engine.EntityPro
is that [`IComponent`](xref:Stride.Engine.FlexibleProcessing.IComponent`2) is not limited to concrete types, your processor may operate on interfaces as well;
```cs
// Here, declaring the interface, which will be the type received by the processor
public interface IInteractable : IComponent<IInteractable.ShapeProcessor, IInteractable>
public interface IInteractable : IComponent<IInteractable.InteractableProcessor, IInteractable>
{
void Interact();
public class InteractableProcessor : IProcessor
Expand All @@ -47,7 +47,7 @@ public interface IInteractable : IComponent<IInteractable.ShapeProcessor, IInter
}
}

// Now any component implementing IInteractable will be processed by the ShapeProcessor
// Now any component implementing IInteractable will be processed by the InteractableProcessor
public class Button : StartupScript, IInteractable
{
public void Interact(){}
Expand Down Expand Up @@ -91,4 +91,4 @@ public interface ISpecialTick : IComponent<ISpecialTick.Processor, ISpecialTick>

## Performance
While it is more flexible, processing components as interfaces instead of concrete class may introduce some overhead.
If the system you're writing is performance critical you should look into strategies to elide or reduce virtual calls in your hot path.
If the system you're writing is performance critical you should look into strategies to elide or reduce virtual calls in your hot path.

0 comments on commit c8136eb

Please sign in to comment.