unity how to create a prefab

Code Example - unity how to create a prefab

                
                        To create a Prefab Asset, drag a GameObject
from the Hierarchy window into the Project window.
                    
                
 

unity csharp instantiate prefab

                        
                                GameObject prefab = reference_to_your_prefab_asset;
Vector3 position = Vector3.zero;
Quaternion rotation = Quaternion.identity;
Transform parent = parent_of_instantiated_prefab;

Instantiate(prefab, position, rotation, parent);
                            
                        
 

Related code examples