instantiate and destroy vs enable and disable

hello,
i am making a 2.5d and i want to have pvp in the game for the most of 10 players, each player has 4 attacks that some of them are used by calling another object, what is more efficiant, have the object sit as the child in the prefab of the character and enable it everytime i need it.
or each time i am using an ability to instantiate the ability prefab if it has one and then destroy it?

i also heard of the object pooling system and i am not sure if its preferred to do it against the others, i would like to know what will be the best approach performance wise.

the prefabs will be used one at a time for each player.

DO NOT OPTIMIZE CODE JUST BECAUSE… If you don’t have a problem, DO NOT OPTIMIZE!

If you DO have a problem, always start by using the profiler:

Window → Analysis → Profiler

Failure to use the profiler means you’re just guessing, making a mess of your code for no good reason.

https://discussions.unity.com/t/841163/2

Notes on optimizing UnityEngine.UI setups:

https://discussions.unity.com/t/846847/2

why shouldn’t i try optimize as much as possible even before i have a problem?
this way i won’t encounter the problem and the game will run more smooth, no?

All optimizations make your project harder and more brittle to work with, especially in the rapid-prototyping phase of things.

But if you’re okay with that extra effort and confusion, you are welcome to spend your time however you like, of course.

Just know that nobody here can actually answer the question of which way is more efficient for objects that you have not even created yet. That’s not a thing.

thanks for the answer, i will try to optimize my code cause i believe it solves problems before they occur, i will try to learn the profiler in order to see what is better

Object pooling is nice if you have a ton of the same thing, which are enabled and disables (like bullets, asteroids, etc). You trade RAM in exchange for more performance.

For your first question:
SetActive(true) (or false) is faster than initializing and destroying the object, as well as generating no garbage (which needs to be collected later on)