/// <summary> /// Returns the first EntityComponent that matches the specified type, if it exists. Otherwise, adds a new instance of the component. /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public T GetOrCreateComponent <T>() where T : EntityComponent, new() { var componentTypeGUID = EntityComponent.GetComponentTypeGUID <T>(); return(NativeInternals.Entity.GetOrCreateComponent(NativeEntityPointer, componentTypeGUID.hipart, componentTypeGUID.lopart) as T); }