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"

In-game c++ change in actor data doesn't refresh

I've got a blueprint function that runs whenever I press a button in-game.

The function modifies a tilemap's data

PROBLEM: the changes are not applied till AFTER I stop and restart the application.

Code of blueprint function:

 UE_LOG(LogTemp, Warning, TEXT("BeginGenerateWorld"));
     TObjectIterator<AActor> Itr;
     UWorld* TheWorld = Itr->GetWorld();
     UPaperTileSet * ts = LoadObjFromPath<UPaperTileSet>(TEXT("/Game/TilemapProject/Tile/oryx_world_bg0.oryx_world_bg0"));
 // That's how I get the tilemap actor
 auto actorItr = TActorIterator<APaperTileMapActor>(TheWorld);
 APaperTileMapActor * tmactor = *actorItr;
 auto tm = tmactor->GetRenderComponent()->TileMap;
 auto tmlayer = tm->TileLayers[0];
 for (int i = 0; i < tmlayer->LayerHeight; ++i)
     for (int j = 0; j < tmlayer->LayerWidth; ++j)
         FPaperTileInfo pti;
         pti.TileSet = ts;
         pti.PackedTileIndex = FMath::RandRange(0, pti.TileSet->GetTileCount() - 1);
         tmlayer->SetCell(j, i, pti);
     UE_LOG(LogTemp, Warning, TEXT("EndGenerateWorld"));
Product Version: Not Selected
more ▼

asked Mar 16 '15 at 07:36 PM in C++ Programming

avatar image

11 2 4 7

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

2 answers: sort voted first

Ok, apparently after I change the tilemap data, I need to manually send an event that something changed. Apparently, the event doesn't matter: I can pass null. I add the below after the changes

 FPropertyChangedEvent evt(nullptr);

more ▼

answered Mar 16 '15 at 10:46 PM

avatar image

11 2 4 7

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

If you have behavior like that it means there need to be update function somewhere, maybe this?


more ▼

answered Mar 16 '15 at 07:49 PM

avatar image

36.6k 932 169 1111

avatar image Babis Mar 16 '15 at 10:07 PM

Nope, it's protected. I was afraid that I'm doing sth conceptually wrong, e.g. modifying the asset archetype rather then instantiated asset in the game, so when I restart it uses the modified asset archetype to instantiate the asset. That's the behavior it has anyway.

avatar image Babis Mar 16 '15 at 10:48 PM

Ok, in the spirit of what you said, but a bit different - I had to do a posteditchangeproperty. I put it as an answer, so that if it sucks, people can explain why

(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