sschmid / Entitas

Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
MIT License
7k stars 1.11k forks source link

Use TryGetComponent instead of GetComponent #1039

Open alexandrunechita-popcore opened 1 year ago

alexandrunechita-popcore commented 1 year ago

https://docs.unity3d.com/ScriptReference/Component.TryGetComponent.html

In here. This place is called at least once per Entity.

namespace Entitas.Unity
{
  public static class EntityLinkExtension
  {
    public static EntityLink GetEntityLink(this GameObject gameObject) => gameObject.GetComponent<EntityLink>();