Unity3d + Guardant
Добрый день.
Пытаемся подружить Unity3d с ключами Guardant, но возникла следующая проблема.
Вот скрипт из Unity, который вешается на простой Cube:
void Start () {
ProgramNumber = 0;
Version = 1;
DongleID = 0;
SerialNumber = 0;
BitMask = 0;
DongleID = 0;
RemoteMode = GrdFMR.Local;
DongleFlags = GrdFM.Mask;
DongleType = GrdDT.ALL;
DongleModel = GrdFMM.ALL;
DongleInterface = GrdFMI.USB;
}
void Awake()
{
Handle GrdHandle = new Handle();
RetCode = (uint) GrdApi.GrdStartup (GrdFMR.Local);
ErrorHandling (GrdHandle, RetCode);
GrdHandle = GrdApi.GrdCreateHandle (GrdCHM.MultiThread);
if (GrdHandle.Address == IntPtr.Zero)
{
ErrorHandling (new Handle(IntPtr.Zero), (uint)GrdE.MemoryAllocation);
}
RetCode = (uint)GrdApi.GrdSetAccessCodes (GrdHandle, PublicCode + CryptPU, ReadCode + CryptRD, WriteCode + CryptWR, MasterCode + CryptMS);
ErrorHandling (GrdHandle, RetCode);
RetCode = (uint)GrdApi.GrdSetFindMode (GrdHandle, RemoteMode, DongleFlags, ProgramNumber, DongleID, SerialNumber, Version, BitMask, DongleType, DongleModel, DongleInterface);
ErrorHandling (GrdHandle, RetCode);
int LMS = -1;
RetCode = (uint)GrdApi.GrdLogin (GrdHandle, LMS, GrdLM.PerStation);
ErrorHandling (GrdHandle, RetCode);
GrdApi.GrdCloseHandle (GrdHandle);
GrdApi.GrdCleanup();
}
При работе с функцией GrdSetFindMode вылетает ошибка:
NullReferenceException: Object reference not set to an instance of an object
PlatformInvoker.Invoke (System.Object[] args)
(wrapper remoting-invoke-with-check) PlatformInvoker:Invoke (object[])
Guardant.GrdApi.GrdSetFindMode (Handle grdHandle, GrdFMR remoteMode, GrdFM flags, UInt32 prog, UInt32 id, UInt32 sn, UInt32 ver, UInt32 mask, GrdDT type, GrdFMM models, GrdFMI interfaces)
GuardantScript.Awake ()
Заранее, спасибо)