I was looking at 2 different ways of making my buildings increase in Size / Capacity. This is being done in 1st person.
The first way was just over , and after long enough It would increase to the next building level.
The second way was wait until I get enough $$$ then be able to choose the building and choose to upgrade.
The first one seems the easiest, wait for XXX . Destroy the current BP and replace with another. The only thing I am not sure about is can I destroy a mesh and then spawn another mesh with in the First mesh, or would this need to be done for example in my player character?
The second way would seem to be a lot more work with having to run line traces to find out what building you want to upgrade, then having a Widget or something similar appear on the screen, enable mouse. Choose the upgrade, destroy the first mesh then spawn another. Or would it be a lot easier than it appears.
Any help would be appreciated. If there is another way that I have not thought about, please tell me.
I have tried to destroy and spawn a new BP within the BP it self. It does not seem to make a difference if I Spawn first or second, the second BP does not spawn. I put a Print String at the end, and it gets called. What may I be missing.
Another idea for you to do could be in the BP itself, use a node called SetStaticMesh to change the looks, and in the graph part use a different batch of code. In my game I use a variable called CurrentUpgradeLevel, which is an int, and when a custom event fires it adds one to it, and changes the static mesh so it looks better. The code of what the blueprint actually does is based on a SwitchOnInt that uses the upgrade level variable, so it does different things on its level as well.
If you want to simply destroy the BP and spawn another, your current set up wont work because it destroys itself before it can spawn another. So basically put the DestroyActor AFTER the other BP is spawned, and it should work
I have a video if you want an example of what I mean with the upgrade levels and setting meshes and changes of code. Notice that though the model changes, it’s still the same blueprint. Helps down the line when you have tons of models/blueprints. https://www.youtube.com/watch?v=lciQ98YdCls