I'm trying to instantiate a rain particle system to follow a circular path. The clouds rotate and move around a circular planet perfectly fine. The problem arises when the particle system is instantiated, it almost never has the correct rotation, no matter where it is spawned. I tried making the particles a child of the cloud, but that didn't work either.
Here is where I instantiate it - this is applied to any given cloud:
void UpdateCloudState(){
if(isRaining == true){
Sprite.color = new Color(.2f,.2f,.2f,1f);
if(!isInstantiated){
rain = Instantiate(RainParticles, this.transform.localPosition, Quaternion.identity) as GameObject;
rain.GetComponent<ParticleSystem>().Play();
isInstantiated = true;
}
}
else{
isInstantiated = false;
Sprite.color = new Color(1f,1f,1f,1f);
rain.GetComponent<ParticleSystem>().Stop();
Destroy (rain, 1.0f);
CloudMovement.speed = originalSpeed;
}
}
UPDATE: After extensive testing i have figured out that the problem is SOLELY when I instantiate a PARTICLE SYSTEM through a script.
-A fix that i discovered: I made an empty prefab the parent of the particle system and then that was made all into 1 prefab.
-I applied the Cloud Movement script (the one that moves and rotates around a circle) to that new prefab and it now works
-HOWEVER, it still does NOT work through scripting when I instantiate it.