#GetRequiredComponentDataPtrX

1 messages · Page 1 of 1 (latest)

void fern
#
public readonly void* GetRequiredComponentDataPtrRO<T>(ref ComponentTypeHandle<T> typeHandle);
public readonly void* GetRequiredComponentDataPtrRW<T>(ref ComponentTypeHandle<T> typeHandle);```

Been annoying me for a long time, but could we please change the return type from `void*` to `T*`?
It should be a non breaking change as you can pass `T*` to `void*` and anyone already casting `T*` will just get warned it's redundant.

All the other return by ptr methods already return the actual type not void
```cs
public readonly T* GetComponentDataPtrRO<T>(ref ComponentTypeHandle<T> typeHandle);
public readonly T* GetComponentDataPtrRW<T>(ref ComponentTypeHandle<T> typeHandle);```

API inconsistencies are frustrating and you get code that looks like this
```cs
var objectIds = (ObjectId*)chunk.GetRequiredComponentDataPtrRO(ref this.ObjectIdHandle);
var presentations = chunk.GetComponentDataPtrRO(ref this.VisualEffectPresentation);```
vagrant rose
#

Seems reasonable to me. It's an API change (albeit a relatively harmless one) , so probably off the table for 1.x, but I'll certainly put it on the list to consider during our next window for breaking changes.