I am experimental the new PCG plugin in UE5.2 from the source build. I try to generate trees from the PCG graph and then create a door that will change the value of the blueprint variable which will be used in the PCG graph. I thought this will change the PCG value during the game. Although this is not working. Does anyone know where could be wrong? Here is the video of my code.
In this video, I create a PCG graph called “PCG_Grass” and I use the “Get actor property” node to get the actor from the world by tag. Although I tried to get it from the parent, it gives a warning that cannot find the variable with the name. After I get the value, I try to toggle the value in the editor, you can see that the content is changing but when I start the game and try to change it when overlap with the door, the value changes but the content is not.
If i remember right from the recent GDC videos that it was mentioned that currentyl PCG editor only right now, this may change on release of full 5.2 or even 5.x.
I wouldbt be using it for anything substantial right now IN GAME anyway as they have said numerous times it could change, just like the new Strata/Substrate materials. They are still work in progress so beware.
Thanks for your reply, I double-checked Arran Langmead’s PCG presentation in GDC. At the end of the video, he said the stuff he showed is editor only, and they do have game involvement which can ship the empty level and completely generate it when the player loads the game.
While writing this, I checked again the " New Tools for Building Photoreal Worlds in Unreal Engine 5.2 | GDC 2023" video from Unreal about the large world prototype around 12:40. He said, “The hierarchical generation concept is to be implemented natively in the framework in the very near future.”
So yeah, I think you are correct.
LOL, I looked too closely at the demo to ignore the sentence. I also won’t use it in any game right now, just experimenting, thanks for the advice.
hey that doesnt mean dont play with it and conceptualise it, just lay off anything heavy for now. You never know when it would be available at runtime!
Your debug log on the top left corner seems to indicate that the value is put to 1 and immediately put back to 0. Might be the issue? Your setup seems fine otherwise.
That is because I set the value to 1 on the beginning overlap when entering the box collision of the door and then set it back to 0 on the ending overlap of the box collision.
The problem here is, the value changed in the blueprint correctly, but it will not pass to the PCG graph while it changed in the blueprint. I cannot find a way or node that let me update the “Get Actor Property” in the PCG graph when the value changed in my blueprint.
The logic was when I overlap with the door, the value changed to 1, the “Get Actor Property” get updated, and then the PCG graph will spawn the second static mesh. Then when I end overlap with the door, the value is back to 0, and the “Get Actor Property” updates, and then the PCG graph will spawn back to the first static mesh.
This logic is working within the Editor when I change the value in the door actor’s detail, but not in runtime.
after applying your workaround I can’t seem to get the pre-existing graph static meshes that are spawned in to go away when the second graph static meshes appear any help would be greatly appreciated
ah it seems I forgot to change the PCG component for the graphs to generate on demand instead of on load. currently working on a PCG building with varying room detail based on when a player enters a room. Out of curiosity have you figured out any way to change the seed of the graph being generated once the collision is activated?
Currently the increment will print similar to the original issue. Also the seed will change if I manually change the integer value in the editor or in the blueprints event graph.
my static mesh spawner is currently using the ToParamData to change the seed.
Any input is greatly appreciated. Still learning the ins and outs of UE5!
I finally find a way that to change the PCG content in the game. You do not need to use the set graph node to change between two graphs, right now, you can switch the static mesh in one PCG graph.
With this logic, I can now play the game and when I go into the door, it will change the static mesh and then when I leave the door, it will change back.
For your changing seed. You can use the same way, here is the logic in the door.
I changed the seed for the surface sampler so that the box it spawns will be random. When you play in-game with the “seed” in constant, it will change all the points’ locations and then when you leave the door, it will change it back. Since the same seed will always spawn in the same way.
Hello,
The PCG in UE 5.2 is awesome, I couldn’t wait for it to be available for packaged game.
The PCG nodes (Set Graph, Cleanup, Generate… ) works well in editor, but not in packaged game. The game freezes, when any of the PCG nodes are executed at runtime in level blueprint.
So, I did the workaround as mentioned below, hope it may help someone desperately wanted to use in game executable right now!
Add multiple PCG volume(s) for each PCG graph that you wanted
Set PCG volume as Movable instead of Static
Set all the PCG volume location as required in final game executable, so that the PCG by editor performs as intended for final game.
In level blueprint (or could be any blueprint), based on conditions, Move the PCG volume(s) location ‘z’ axis value for up / down to visible / hide under the ground level.
Note: I use Set World Location node on PCG volume → Brush component to move up / down.