/// <summary> /// Checks if the UObject which owns this struct is destroyed (if this struct is contained within a UObject) /// </summary> protected void CheckDestroyed() { if (Owner != null && Owner.IsDestroyed) { throw new UObjectDestroyedException("Trying to access a StructAsClass which points to memory of a destroyed UObject (" + NativeReflection.GetPathName(structAddress) + ")"); } if (!initialized) { throw new Exception("Trying to access a StructAsClass which either wasn't initialized or was destroyed (" + NativeReflection.GetPathName(structAddress) + ")"); } }
private static bool ValidateFunction(UObject obj, FName functionName) { // Same validation that is in UKismetSystemLibrary::K2_SetTimer if (obj != null && functionName != FName.None) { IntPtr functionAddress = Native_UObject.FindFunction(obj.Address, ref functionName); if (functionAddress != IntPtr.Zero && Native_UFunction.Get_ParmsSize(functionAddress) > 0) { // User passed in a valid function, but one that takes parameters // FTimerDynamicDelegate expects zero parameters and will choke on execution if it tries // to execute a mismatched function FMessage.Log(ELogVerbosity.Warning, "SetTimer passed a function (" + NativeReflection.GetPathName(functionAddress) + ") that expects parameters."); return(false); } } return(true); }