private static void OnPostWorldCleanup(IntPtr world, bool sessionEnded, bool cleanupResources) { // At this point UGameInstance::WorldContext should have been set to nullptr. While WorldContext being nullptr // doesn't mean the UGameInstance is nessesarily "destroyed" but there isn't any code which reinitializes // UGameInstance by calling UGameInstance::InitializeStandalone / UGameInstance::InitializeForMinimalNetRPC // // UEditorEngine::TeardownPlaySession() // { // UGameInstance::Shutdown(); - sets this->WorldContext = nullptr // PlayWorld->CleanupWorld(); - called shortly after Shutdown() // { // // These delegates are the first available delegates we can use after UGameInstance state is invalidated // FWorldDelegates::OnWorldCleanup // FWorldDelegates::OnPostWorldCleanup // } // } // TODO: Only call this on types which override this function IntPtr gameInstance = Native_UWorld.GetGameInstance(world); foreach (StaticVar staticVar in Vars) { if (gameInstance != IntPtr.Zero) { staticVar.OnGameInstanceShutdown(gameInstance); } staticVar.OnWorldDestroyed(world); } }
public virtual bool TryGetValue(UObject worldContextObject, out T value) { IntPtr world = Native_UObject.GetWorld(worldContextObject.Address); if (worldTypeFlags == 0) { if (values.TryGetValue(world, out value)) { return(true); } } else if (world != IntPtr.Zero) { int worldType = (1 << (int)Native_UWorld.Get_WorldType(world)); if ((worldTypeFlags & worldType) == worldType) { if (values.TryGetValue(world, out value)) { return(true); } } } value = default(T); return(false); }
internal static void OnNativeFunctionsRegistered() { timeSecondsOffset = Native_UWorld.Offset_TimeSeconds(); unpausedTimeSecondsOffset = Native_UWorld.Offset_UnpausedTimeSeconds(); realTimeSecondsOffset = Native_UWorld.Offset_RealTimeSeconds(); deltaTimeSecondsOffset = Native_UWorld.Offset_DeltaTimeSeconds(); pauseDelayOffset = Native_UWorld.Offset_PauseDelay(); }
public T Set(UObject worldContextObject, T value) { IntPtr gameInstance = Native_UWorld.GetGameInstance(worldContextObject.Address); if (gameInstance != IntPtr.Zero) { values[gameInstance] = value; } return(value); }
public virtual bool Clear(UObject worldContextObject) { IntPtr gameInstance = Native_UWorld.GetGameInstance(worldContextObject.Address); if (gameInstance != IntPtr.Zero) { return(values.Remove(gameInstance)); } return(false); }
public virtual bool HasValue() { IntPtr world = GetDefaultWorld(); if (world != IntPtr.Zero) { IntPtr gameInstance = Native_UWorld.GetGameInstance(world); return(gameInstance != IntPtr.Zero && values.ContainsKey(gameInstance)); } return(false); }
public virtual bool TryGetValue(UObject worldContextObject, out T value) { IntPtr gameInstance = Native_UWorld.GetGameInstance(worldContextObject.Address); if (gameInstance != IntPtr.Zero) { if (values.TryGetValue(gameInstance, out value)) { return(true); } } value = default(T); return(false); }
public T Set(T value) { IntPtr world = GetDefaultWorld(); if (world != IntPtr.Zero) { IntPtr gameInstance = Native_UWorld.GetGameInstance(world); if (gameInstance != IntPtr.Zero) { values[gameInstance] = value; } } return(value); }
public virtual bool Clear() { IntPtr world = GetDefaultWorld(); if (world != IntPtr.Zero) { IntPtr gameInstance = Native_UWorld.GetGameInstance(world); if (gameInstance != IntPtr.Zero) { return(values.Remove(gameInstance)); } } return(false); }
public AActor SpawnActor(UClass unrealClass, ref FVector location, ref FRotator rotation, ref FActorSpawnParameters parameters) { FActorSpawnParametersInterop interopParams = new FActorSpawnParametersInterop() { Name = parameters.Name, Template = parameters.Template == null ? IntPtr.Zero : parameters.Template.Address, Owner = parameters.Owner == null ? IntPtr.Zero : parameters.Owner.Address, Instigator = parameters.Instigator == null ? IntPtr.Zero : parameters.Instigator.Address, OverrideLevel = parameters.OverrideLevel == null ? IntPtr.Zero : parameters.OverrideLevel.Address, SpawnCollisionHandlingOverride = parameters.SpawnCollisionHandlingOverride, PackedBools = parameters.PackedBools, ObjectFlags = parameters.ObjectFlags }; return(GCHelper.Find <AActor>(Native_UWorld.SpawnActor(Address, unrealClass.Address, ref location, ref rotation, ref interopParams))); }
public virtual bool HasValue(UObject worldContextObject) { IntPtr world = Native_UObject.GetWorld(worldContextObject.Address); if (worldTypeFlags == 0) { return(values.ContainsKey(world)); } else if (world != IntPtr.Zero) { int worldType = (1 << (int)Native_UWorld.Get_WorldType(world)); if ((worldTypeFlags & worldType) == worldType) { return(values.ContainsKey(world)); } } return(false); }
public virtual bool TryGetValue(out T value) { IntPtr world = GetDefaultWorld(); if (world != IntPtr.Zero) { IntPtr gameInstance = Native_UWorld.GetGameInstance(world); if (gameInstance != IntPtr.Zero) { if (values.TryGetValue(gameInstance, out value)) { return(true); } } } value = default(T); return(false); }
public virtual bool Set(UObject worldContextObject, T value) { IntPtr world = Native_UObject.GetWorld(worldContextObject.Address); if (worldTypeFlags == 0) { values[world] = value; return(true); } else if (world != IntPtr.Zero) { int worldType = (1 << (int)Native_UWorld.Get_WorldType(world)); if ((worldTypeFlags & worldType) == worldType) { values[world] = value; return(true); } } return(false); }
public static FTimerManager GetManager(IntPtr address) { if (address == IntPtr.Zero) { return(null); } TimerManagerInfo timerManagerInfo; if (timerManagers.TryGetValue(address, out timerManagerInfo)) { return(timerManagerInfo.TimeManager); } UpdateOwnerClasses(); IntPtr owner = IntPtr.Zero; if (owner == IntPtr.Zero && worldClass != IntPtr.Zero) { foreach (IntPtr world in new NativeReflection.NativeObjectIterator(worldClass)) { IntPtr timerManager = Native_UWorld.GetTimerManager(world); if (timerManager == address) { IntPtr gameInstance = Native_UWorld.GetGameInstance(world); if (gameInstance != IntPtr.Zero && Native_UGameInstance.GetTimerManager(gameInstance) == address) { owner = gameInstance; break; } else { owner = world; break; } } } } if (owner == IntPtr.Zero && gameInstanceClass != IntPtr.Zero) { foreach (IntPtr gameInstance in new NativeReflection.NativeObjectIterator(gameInstanceClass)) { if (Native_UGameInstance.GetTimerManager(gameInstance) == address) { owner = gameInstance; break; } } } if (owner == IntPtr.Zero && editorEngineClass != IntPtr.Zero) { foreach (IntPtr editorEngine in new NativeReflection.NativeObjectIterator(editorEngineClass)) { if (Native_UEditorEngine.GetTimerManager(editorEngine) == address) { owner = editorEngine; break; } } } if (owner != IntPtr.Zero) { FWeakObjectPtr ownerWeakObjPtr = new FWeakObjectPtr(); ownerWeakObjPtr.Set(owner); timerManagerInfo = new TimerManagerInfo(); timerManagerInfo.Owner = ownerWeakObjPtr; timerManagerInfo.TimeManager = new FTimerManager(address); timerManagers.Add(address, timerManagerInfo); timerManagerOwners[ownerWeakObjPtr] = address; return(timerManagerInfo.TimeManager); } else { return(new FTimerManager(address)); } }
public FLatentActionManager GetLatentActionManager() { return(new FLatentActionManager(Native_UWorld.GetLatentActionManager(Address))); }
public virtual bool HasValue(UObject worldContextObject) { IntPtr gameInstance = Native_UWorld.GetGameInstance(worldContextObject.Address); return(gameInstance != IntPtr.Zero && values.ContainsKey(gameInstance)); }
public AActor SpawnActor(UClass unrealClass, ref FVector location, ref FRotator rotation) { FActorSpawnParametersInterop parameters = default(FActorSpawnParametersInterop); return(GCHelper.Find <AActor>(Native_UWorld.SpawnActor(Address, unrealClass.Address, ref location, ref rotation, ref parameters))); }
public APlayerController GetFirstPlayerController() { return(GCHelper.Find <APlayerController>(Native_UWorld.GetFirstPlayerController(Address))); }