// use start since the object is not active at the begining private void Awake() { // to get renderer and default color render = this.GetComponent <Renderer>(); pooler = this.transform.GetComponentInParent <EnemiesPooling>(); colorPropertyId = Shader.PropertyToID("_Color"); defaultColor = render.material.GetColor(colorPropertyId); // reset health resetAttribute(); }
// Used for initialization on spawn public void changePooler(EnemiesPooling pooler) { this.pooler = pooler; }