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
3
Question by St4rKiller070 · May 05, 2013 at 07:41 PM · uniqueunique-identifiersidentify

Do objects have unique id?

In my game, I have a lot of cloned objects. All of them have the same name and I don't know how to distinguish them. Do objects in Unity have something like unique id?

Comment
Add comment · Show 1
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 Bonfire-Boy · Jul 08, 2015 at 09:32 PM 0
Share

How are you creating them? Can you not set their names to something unique yourself, when you do so?

2 Replies

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

Answer by Eric5h5 · May 05, 2013 at 07:44 PM

Object.GetInstanceID

Comment
Add comment · Show 2 · 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 BobbyDoogle · Mar 15, 2014 at 06:53 AM 0
Share

Can I ask, is this id permanent. I am thinking of using it as an identifier for a save/load system, but if it were to change it would break saves.

avatar image Eric5h5 · Mar 15, 2014 at 06:59 AM 2
Share

It's not permanent; the only guarantee is that it's unique.

avatar image
0

Answer by RKSandswept · Jun 11, 2015 at 03:01 AM

I implementd some simple C++ for UIDs. Then the NPC class has a uid on the server that is unique and replicate4d.

The .h file

     static int32 nextUid;
 
     UFUNCTION(BlueprintCallable, Category = TDLHelpers)
         static int32 GetNextTDLUID();
 


The .cpp

 int32 UtdlBlueprintHelpers::nextUid = 1;
 
 int32 UtdlBlueprintHelpers::GetNextTDLUID()
 {
     return nextUid++;
 }
Comment
Add comment · Show 2 · 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 Eric5h5 · Jun 11, 2015 at 03:04 AM 0
Share

This has nothing to do with Unity.

avatar image phxvyper · Jul 08, 2015 at 09:10 PM 0
Share

@Eric5h5 sure it does. You can implement C++ (or any native/static/linked/managed code) in Unity using their Plugins system. This method that @R$$anonymous$$Sanswept has provided would work just fine. However, it isn't really effective for this question.

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

15 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 avatar image avatar image avatar image avatar image

Related Questions

How to get some unique identifier for GameObjects? 1 Answer

Is deviceUniqueIdentifier actually unique? 0 Answers

iPhone Unique Identifier 1 Answer

Making Duplicate Terrain Unique? 1 Answer

How to identify the shape of a line renderer. 0 Answers


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