- Home /
How can I generate a GUID or a UUID from within Unity
Do we use GUID ?
for future readers, Unity does all this work for you ...
http://answers.unity3d.com/questions/373055/deviceuniqueidentifier-curiosity-.html
This guy is not looking at device UUID but just a UUID string in general as a key to use in a data structure schema
True, but it's a bad idea :) it's like asking about generators when all you need is Invoke. Or program$$anonymous$$g physics by hand in Unity, ins$$anonymous$$d of using PhysX.
As I said, for future readers the fact is you just use the amazing function Unity has built-in for this purpose. The scheme presented below (of using the five "random" items) is appalling program$$anonymous$$g on many levels. If you have a job and did that you'd just be fired (well certainly by me anyways! :) )
No it's not the same. He didn't say he wants the unique device ID, so don't jump to conclusions. What if he needs multiple GUIDs for different purposes on a single device? Then your approach is kinda useless, since the ID will always be the same per device.
working with you Fattie must be really fun :D guy who doesn't read specs and then fire random guy ... ROFL
btw ... we've made our proper physics engine :D the one in unity can't do stuff we needed
Answer by Bunny83 · May 06, 2012 at 03:10 AM
According to [Mono Compatibility page][1] Guid is fully supported on all platforms / Mono versions.
It's:
System.Guid.NewGuid();
So in C# you would do something like:
System.Guid myGUID = System.Guid.NewGuid();
Usually you want:
string newBackstageItemID = System.Guid.NewGuid().ToString();
(Like poday mentioned, if you use the micro mscorlib the Guid class is not included and you have to use a custom way to build a pseudo Guid.)
[1]: http://unity3d.com/support/documentation/ScriptReference/MonoCompatibility
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Text rendering bug. Shows black squares. -1 Answers
Serialize a list on iPhone 1 Answer
Using Unity for a IOS Menu Only 0 Answers
iOS tracing input? 1 Answer