1) Using the following operators causes an unwanted result or throw error -
NewPillar = Instantiate (Single, Single.transform);
OR
NewPillar = Instantiate (Single); NewPillar.transform.parent = Single.transform;
2) You can get around this using the following code -
NewPillar = Instantiate (Single, Single.transform.position, Single.transform.rotation);
Explanation: Single is a precast, not an actual object in the scene. A transform is also a component that determines the position, rotation, and scale of an object in a scene. According to Unity3D, since Single is a prefab, its conversion component is directly disabled to prevent data corruption. That is why we get an error when using the operators in paragraph 1 above.
But we can use the location, rotation and scale data stored in the prefab transform component. This allows us to use the statement in paragraph 2 above.
source share