Prevent Utf8StringToNative.GetInstance getting optimized out

This commit is contained in:
Garry Newman 2019-08-07 19:43:44 +01:00
parent 1e5dc7b2ea
commit 1a02a9c363

View File

@ -31,6 +31,7 @@ public void Init()
return;
}
PreservationHack();
throw new System.Exception( "Trying to initialize Steam Interface but Steam not initialized" );
}
@ -109,5 +110,15 @@ internal virtual void Shutdown()
}
public abstract void InitInternals();
internal void PreservationHack()
{
//
// Stop Utf8StringToNative.GetInstance getting culled by stuff like Unity's
// asselmbly optimization stuff. Here we just call it so it can't not exist.
//
var i = Utf8StringToNative.GetInstance( "don't cull this function" );
i.GetNativeDataSize();
}
}
}