Skip to content

Instantly share code, notes, and snippets.

@SteveSwink
Created May 22, 2015 22:51
Show Gist options
  • Save SteveSwink/c6aeee911f0e0eae6286 to your computer and use it in GitHub Desktop.
Save SteveSwink/c6aeee911f0e0eae6286 to your computer and use it in GitHub Desktop.
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