2 instantiation types and their benefits?

Ok, to start off with, im not a programmer, im a designer who is programming, so you’ll have to excuse the possibility that this question may seem trivial or may have already been answered.

So i was basically running through my code trying to clear out any redundancies and change variable types (eg. int to byte) to reduce as much memory or cpu usage as possible.

For most things I have this (for example):

//prefab assigned in unity editor
public GameObject letterASymbol;

//no prefab assigned in editor
public GameObject[] alphabetSymbols = new GameObject [27];

void update ()
{
       alphabetSymbols [0] = (GameObject) Instantiate(letterASymbol, Vector3.zero, Quaternion.identy);
}

but then i tried this (attempting to reduce number of GameObject variables)

//All array elements assigned with prefabs in unity editor
public GameObject[] alphabetSymbols = new GameObject [27];
    
    void update ()
    {
           alphabetSymbols [0] = (GameObject) Instantiate(alphabetSymbols [0], Vector3.zero, Quaternion.identy);
    }

It seems to work fine and even did a quick test to see what happens:

//All array elements assigned with prefabs in unity editor
public GameObject[] alphabetSymbols = new GameObject [27];

bool onceTest = false;

void Update () 
	{
		if (!onceTest)
		{
			alphabetSymbols [0] = (GameObject) Instantiate(alphabetSymbols [0], new Vector3.zero, Quaternion.identity);

			alphabetSymbols [0].GetComponent<SpriteRenderer> ().enabled = true; //as it was default set to false in editor by myself

			alphabetSymbols [0].GetComponent<SpriteRenderer> ().color = new Color (1f, 1f, 1f, 0.5f);

			Destroy (alphabetSymbols [0]);

			alphabetSymbols [0] = (GameObject) Instantiate(alphabetSymbols [0], new Vector3.zero, Quaternion.identity);

			onceTest = true;
		}	
	}

When its instantiated the second time, the alpha is still at 0.5f and stuff.

I guess my question is, if you’re careful about making sure all the parameters are reset (colour alpha, position, scale, etc) before you destroy it (if thats what you want of course), is this better memory/cpu wise? Or am I quibbling about negligible differences? Is this a better way in terms of keeping code less cluttered?

Like you wrote, you’re not a coder. Imagine the mess a novice 3D modeller would make trying to “improve” an existing model for size/speed.

The main thing experienced coders know is not to worry about the time/space for a mere 27 objects. You’ll save way more looking for far-too-large textures (for example.) (My super-long explanation is at taxesforcatses-dot-com in the C# section under “efficiency.”)

RE: resetting before destroying

Destroyed objects are shredded back down to bits. That’s a standard coding thing. Instantiate won’t try to find a suitable old object (like searching a junkyard for a usable muffler.) It just grabs the first free bits. But people do use that “reset for reuse idea.” You can not Destroy the object - just hide it and reuse it later. The standard name for that extra coding is a pool. But it’s rarely worth it.

And spawning alphabetSymbols[0] over and over in Update? There’s a Unity example of spawning blocks into an array (Unity - Manual: Instantiating Prefabs at run time). That seems like what you’re trying to do.