I want to make a top down space shooter.
The bullets are particle.
On my Enemy Class i have made this:
void OnParticleCollision(GameObject other) {
life--;
if (life <= 0) {
Destroy(gameObject);
}
}
This working perfect.
But one of my mechanic in this game is, to shoot bullets with different color.
So the player can switch his bullet color.
Some Enemys are resisdent against a specific color.
So I must check in the OnParticleCollision() which color the colliding Particle have.
void OnParticleCollision(GameObject other) {
life--;
//Check here which Color this Particle have
//<--- insert code
if (life <= 0) {
Destroy(gameObject);
}
}
Does somebody has any idea?
Thanks, but Unity give me this error: Material doesn't have a color property '_Color' UnityEngine.Material:get_color()
– crimelinegamesOk I changed the Particle Material from "Default-Particle" to "Sprites-Default" and now there is no error. But now it returns 1,1,1. I think this is the color of the Sprite Material without the color of the ParticleSystem :S
– crimelinegamesThanks a lot. This works great. ;)
– crimelinegames