Skip to content
This repository has been archived by the owner on May 3, 2019. It is now read-only.

Commit

Permalink
allow world context to be passed during init
Browse files Browse the repository at this point in the history
  • Loading branch information
ashea-code committed Sep 10, 2015
1 parent 250f6e5 commit 73d4be5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions Source/Blu/Private/BluEye.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ UBluEye::UBluEye(const class FObjectInitializer& PCIP)

}

void UBluEye::init()
void UBluEye::init(UObject* WorldContextObject)
{

/**
* We don't want this running in editor unless it's PIE
* If we don't check this, CEF will spawn infinit processes with widget components
**/
/**
* We don't want this running in editor unless it's PIE
* If we don't check this, CEF will spawn infinit processes with widget components
**/
const UWorld* world = GEngine->GetWorldFromContextObject(WorldContextObject);
if (GEngine)
{
if (GEngine->IsEditor() && !GWorld->IsPlayInEditor())
if (!world->IsGameWorld() && !world->IsPlayInEditor())
{
UE_LOG(LogBlu, Log, TEXT("Notice: not playing - Component Will Not Initialize"));
return;
Expand Down
4 changes: 2 additions & 2 deletions Source/Blu/Public/BluEye.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class BLU_API UBluEye : public UObject
//GENERATED_UCLASS_BODY()

/** Initialize function, should be called after properties are set */
UFUNCTION(BlueprintCallable, Category = "Blu")
void init();
UFUNCTION(BlueprintCallable, Category = "Blu", meta = (WorldContext = "WorldContextObject"))
void init(UObject* WorldContextObject);

/** The default URL this UI component will load */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Blu")
Expand Down

0 comments on commit 73d4be5

Please sign in to comment.