Created
May 22, 2015 22:51
-
-
Save SteveSwink/c6aeee911f0e0eae6286 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class Guid : MonoBehaviour | |
{ | |
[SerializeField] | |
private string guidAsString; | |
private System.Guid _guid; | |
public System.Guid guid | |
{ | |
get | |
{ | |
if ( _guid == System.Guid.Empty | |
!System.String.IsNullOrEmpty( guidAsString ) ) | |
{ | |
_guid = new System.Guid( guidAsString ); | |
} | |
return _guid; | |
} | |
} | |
public void Generate() | |
{ | |
_guid = System.Guid.NewGuid(); | |
guidAsString = guid.ToString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment