.setActive(true) not functioning.
Hello,
I am working with a few objects with particle systems attached. I am attempting to disable and re-enable these objects withe gameObject.setActive(false) and gameObject.setActive(true) respectively and while setActive(false) works fine I cannot seem to get setActive(true) to function. I am calling both from a parent object, so I am not just skipping the code to re-enable the gameObject.
My disabling code.
for (int i = 0; i < _Rain.Length; i ++) {
for (int x = 0; x < _Rain[i].particleEffect.Length; x ++) {
_Rain [i].particleEffect [x].gameObject.SetActive (false);
}
}
My enabling code.
if (x == rainAmount) {
for (int y = 0; y < _Rain[x].particleEffect.Length; y++) {
_Rain [x].particleEffect [y].gameObject.SetActive (true);
}
These are both called from a co-routine in a seperate object and class from the particleSystem.
Answer by Lord_Ford · Aug 23, 2015 at 03:47 PM
It could be possible that your particles have an 'exit time'. If this is the case, then you are setting it active but the particle system has nothing left to play. Hence you not being able to see anything. Cheers and good Luck! - PlayWell Studios
Your answer
Follow this Question
Related Questions
Disable Object and Enable by Distance from Player 1 Answer
How to enabled a specific gameObject in array? 0 Answers
Play mode enables objects 0 Answers
script enable=false 3 Answers
How to make a UI Image appear/disappear? 2 Answers