Add PaperSpriteComponent can be used in exactly the same way as an Add StaticMeshComponent node. The example from Penguin only adds one sprite, you’d need to use it in a for loop or otherwise call it multiple times if you want to make multiple components.
To edit the component template that an Add Component node uses, select the ‘Add Component’ node in the graph, and edit the properties in the Details panel in the bottom left. This is where you set the kind of sprite or mesh or etc… to spawn. You can always change it later using Add Sprite like Penguin demonstrated too.
Note: You can also drag-drop a sprite asset or mesh or whatever from the content browser directly into the Blueprint graph, which will create an Add Component node already pointing to the asset you want to spawn.
I got the blueprint adding sprites but unfortunately, when I move the end point back towards the root, instead of eliminating the sprites it just adds more and more. Went from not adding enough sprites to way too many! :rolleyes:
Is it an attachment issue? Do I need to remove sprites every time the end point moves?
I did something like this a while ago, but in geo. ie. to spawn child actors in between start/end point. works fine but I manually setup how many of them I want.
I wonder what you would have if you actually hits simulate/play? If it works fine, then it might just be a bug you found for construction script for paper sprite component.
Because any changes you made in editor should trigger construction script, in this case it should reconstruct the BP so all the dynamically generated component should be destroyed before new ones gets generated.
Hello all! I m trying to make a 2D terrain made of destructible sprites with this procedural scripts. Its work to generate the sprites in the right location but when I try to destroy one brick the engine consider all the bricks as just one and all then take damage and explode… there is a work around for this?
Hey @Mhousse1247 thank u for your answers… this is so cool that u are give away your code. I appreciate. But What I m looking to accomplish is load like 1000 terrain sprites procedurally for make bigger terrains and make this for a lot of levels so I don’t intend to make this one by one and group the sprites… I even don’t know if is possible to load “instanced sprite” like we can do with “static meshes”…
Btw, I just visit your site! Its amazing, gratz and thank!
You can use AddInstance to add any sprite you want ( it’s not like with meshes where you have only on mesh asset)
Also if you use 1000 * AddSpriteComponent , you will have 1000 draw calls in your scene and it’s not optimal at all , but with GroupedSpriteComponent sprites sharing the same texture will be batched in one draw call
I was looking for this “one” magic draw call… With groupedSpriteComponent I should mount one by one?
How is possible to make a huge 2d terrain with sprites with no draw calls problem? There is not a workaround for this? The only way to have a destructible “2d tilemap” is using sprites?
There is a way to load a lot of sprites and after this try to merge then by bpscript on the runtime?