how to name GameObject in csharp

Code Example - how to name GameObject in csharp

                
                        GameObject.name = "Ben";
                    
                
 

how to access gameobject name

                        
                                // note how the 'g' is lowercase, when it's lowercase it accesses the GameObject its attached to
gameObject.name
// so if this script was attached an object named "Player", it will access "Player"
                            
                        
 

Related code examples