Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
5
Question by valichm · Apr 11, 2012 at 06:29 PM · gameobjectclonesrename

[Solved] Renaming game object clones instantiated

I have a script that refers to myObject(Clone). The script however, includes destroying this object and instantiating a second time, third time, fourth time, etc. The name changes to myObject(Clone)(Clone) and keeps adding (Clone) as more are instantiated. How can I avoid this or change this name so that they are all the same. Only one is active at a time, so I'd prefer they all just be named "myObject"

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
10
Best Answer

Answer by Eric5h5 · Apr 11, 2012 at 06:33 PM

 var prefab : GameObject;
 
 function Start () {
     var clone = Instantiate (prefab);
     clone.name = "Whatever";
 }
Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rene_cayunir · Oct 06, 2016 at 01:39 AM 0
Share

why in that function ??????????????????

avatar image Eric5h5 rene_cayunir · Oct 06, 2016 at 03:36 AM 0
Share

No reason.

avatar image sandeepsmartest rene_cayunir · Oct 06, 2016 at 04:21 AM 0
Share

start() method calls as soon as we hit play button, Awake() gets called prior to Start().Rena$$anonymous$$g , initialisations are one time operations so its better to write it in start which gets called only once unless you reload scene or deactivate/activate object.Remember string operations are costly which collects GC so if possible do not do it or do it only once. Nsks

avatar image Willard720 rene_cayunir · Apr 23, 2018 at 10:41 AM 1
Share

Why so many question marks???????????????

avatar image nowletsstart · Oct 31, 2018 at 06:19 PM 0
Share

@Eric5h5 I would be extremely grateful if you could please take assist me with clone several game objects. I asked the original question was asked on Stackoverflow how to clone several game objects in a way that clone properties of one can be adjusted to match all others in scene view, which hasn't been answered.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I refer to the name of the game object the script is attached to? 1 Answer

Fire an event when gameObject has been renamed? 2 Answers

Sharing components amongst different gameobjects 1 Answer

using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers

All subsequent instantiated objects = auto-named with suffix (Clone)? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges