Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

C++ Derived Blueprint: TArray<> not working in standalone window

I have a C++ gamemode in which i declare the following TArray<>:

 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Collection)
 TArray<ASpriteActor*> Tiles;

I also have a Blueprint derived from this class. In this Blueprint i have a function that spawns ASpriteActors and adds them to the array. But for some reason this only works in Editor and not in Separate Windows (e.g. mobile preview, packaged game, etc.). I don't get any error or anything, the function just does not spawn the actors.

The funny thing is that it DOES work when i create a separate array in the blueprint and use it instead of the c++ array. I may be missing some required UPROPERTY or something, but i have not found anything as to why this problem occurs.

I hope some of you can give me more insight, thanks in advance :)

alt text Wiring Test instead of Tiles works in-editor as well as in other windows.

Product Version: UE 4.14
confused.jpg (177.0 kB)
more ▼

asked Feb 08 '17 at 08:53 PM in C++ Programming

avatar image

33 2 3 4

avatar image Sean L ♦♦ STAFF Feb 08 '17 at 09:27 PM

Hey Neodymus,

I've attempted to reproduce your issue, but I'm not seeing the same results. Here's how I'm populating my array. For my test, I've used just the base Actor class. Not all of the code is necessary, but I put in some extra checks and logging just for testing purposes.


 void AMyActor::BeginPlay()
     for (int counter = 0; counter < 5; counter ++)
         UWorld* World;
         World = GetWorld();
         if (World)
             AActor* TempActor;
             TempActor = World->SpawnActor<AActor>();
         AActor* ArrayActor = Tiles[counter];
         UE_LOG(LogTemp, Warning, TEXT("Tiles[%d] = %s"), counter, *ArrayActor->GetName());
         GEngine->AddOnScreenDebugMessage(-1, 2.0, FColor::Emerald, (TEXT("Tiles[%d] = %s"), counter, *ArrayActor->GetName()), true, FVector2D(2,2));

I also did as you did and used a blueprint with the setup pictured below and I'm seeing it working great in Standalone as well:

alt text

If you could provide your blueprint as well as your code or point out the steps I'm missing on my end that'd be great.


(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Nevermind, my error was in another function. Apparently GetViewPort size returned 0 sincethe HUD was not rendered in time.

more ▼

answered Feb 08 '17 at 09:26 PM

avatar image

33 2 3 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question