Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: VascBogdan on February 07, 2015, 02:00:43 PM

Title: [SOLVED]Prefab dinamic variable
Post by: VascBogdan on February 07, 2015, 02:00:43 PM
On my scene, I have like a lot of enemies, the same enemies from a prefab. I have a n EnemyHealth prefab, but it works only for an enemy.

Is there a way to create a variable for a prefab, so every single gameobject will have it's own value ? I think the solution is not to create something like: Enemy1Health, Enemy2Health, Enemy3Health.... Enemy30Health, because it would be a spam.
Title: Re: Prefab dinamic variable
Post by: VascBogdan on February 08, 2015, 05:12:36 AM
Solved it another way.

I created a variable (not global) called HitCount. Whenever the enemy is hit, the HitCount increase with 1. When HitCount is at the maximum (the enemy health), the enemy will die.
This works with prefabs. Maybe it's helpful for someone.