Search code examples
unreal-engine4unreal-blueprint

Variable changes on all spawned enemies instead of changing only on self


Ok so I am trying to make this work for a week now and I ran out of solutions.

I am spawning an enemy on a specified spawn point. Then I am randomizing his index. (The index specifies the type of the enemy)

But every time I add one more enemy to the scene they both have the same index for some reason. After killing one of them the index of the other comes back to normal.

Can anyone tell me what is the problem, please?

enter image description here

enter image description here


Solution

  • Check you had set different Materials in your Current Material, correctly.

    problem should be this:

    To use Set Material instead of Create Dynamic Material Instance

    https://docs.unrealengine.com/en-US/BlueprintAPI/Rendering/Material/SetMaterial/index.html