Some fixes with coral

This commit is contained in:
antopilo
2025-01-17 17:59:17 -05:00
parent 6b53ab6f8f
commit ab534fe929
3 changed files with 15 additions and 9 deletions

View File

@@ -7,16 +7,20 @@ namespace Nuake.Net
public class Scene
{
internal static unsafe delegate*<NativeString, int> GetEntityIcall;
internal static unsafe delegate*<NativeString, NativeInstance<Entity>> GetEntityScriptFromNameIcall;
internal static unsafe delegate*<NativeString, NativeInstance<object>*, void> GetEntityScriptFromNameIcall;
internal static unsafe delegate*<int, NativeInstance<Entity>> GetEntityScriptFromHandleIcall;
internal static unsafe delegate*<NativeString, int> InstancePrefabIcall;
public static T? GetEntity<T>(string entityName) where T : class
{
NativeInstance<Entity> handle;
unsafe { handle = GetEntityScriptFromNameIcall(entityName); }
NativeInstance<object> handle;
Entity? entity = handle.Get();
// This doesnt :(
unsafe { GetEntityScriptFromNameIcall(entityName, &handle); }
object? entity = handle.Get();
Engine.Log("Fetched entityL: " + entity);
if (entity != null && entity is T)
{
return entity as T;