This is not a duplicate! Why? Because I’ve tried different variants of Instantiate() with gameObjectToCopy and its transform as parameteres and none did the trick. What I want is exactly the same object (the same size, position, rotation, material, everything) but, of course, a copy, not a reference. But when I use Instantiate() the result is weird - the cloned object is scaled down/missing its material/whatever. So how to duplicate a GameObject to get the exact copy (in script)?
Example code:
copy = ((Transform)Instantiate(piece.transform, piece.transform.position, piece.transform.rotation)).gameObject;
copy = (GameObject)GameObject.Instantiate(piece);