public IntPtr GetFunctionAddress() { if (FunctionName == FName.None) { return(IntPtr.Zero); } IntPtr obj = Object.GetPtr(); return(obj == IntPtr.Zero ? IntPtr.Zero : Native_UObject.FindFunction(obj, ref FunctionName)); }
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); }
/// <summary> /// Looks for a given function name /// </summary> public UFunction FindFunction(FName name) { return(GCHelper.Find <UFunction>(Native_UObject.FindFunction(Address, ref name))); }