Download LyraStarterGame/Source/LyraGame/System/LyraActorUtilities.cpp from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 1.13 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/System/LyraActorUtilities.cpp
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Source/LyraGame/System/LyraActorUtilities.cpp
-
curl -L -o LyraActorUtilities.cpp https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/System/LyraActorUtilities.cpp
1.13 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| EBlueprintExposedNetMode ULyraActorUtilities::SwitchOnNetMode(const UObject* WorldContextObject) | |
| { | |
| ENetMode NetMode = NM_Standalone; | |
| for (const UObject* TestObject = WorldContextObject; TestObject != nullptr; TestObject = TestObject->GetOuter()) | |
| { | |
| if (const UActorComponent* Component = Cast<const UActorComponent>(WorldContextObject)) | |
| { | |
| NetMode = Component->GetNetMode(); | |
| break; | |
| } | |
| else if (const AActor* Actor = Cast<const AActor>(WorldContextObject)) | |
| { | |
| NetMode = Actor->GetNetMode(); | |
| break; | |
| } | |
| } | |
| switch (NetMode) | |
| { | |
| case NM_Client: | |
| return EBlueprintExposedNetMode::Client; | |
| case NM_Standalone: | |
| return EBlueprintExposedNetMode::Standalone; | |
| case NM_DedicatedServer: | |
| return EBlueprintExposedNetMode::DedicatedServer; | |
| case NM_ListenServer: | |
| return EBlueprintExposedNetMode::ListenServer; | |
| default: | |
| ensure(false); | |
| return EBlueprintExposedNetMode::Standalone; | |
| } | |
| } | |