Instantiate only once in Update and be able to use the clone variable in a switch statement(in Update).

Hi, I am trying to create object pooling in my script, For that I only want to Instantiate an object once and use it in a switch statement(All of this is in a separate void function. Then I put this function in Update(). Since I’m putting the void function in Update, the instantiate is creating too many clones. How can I solve this problem?

Any Help is appreciated!

I solved the problem, but thanks for replying!