A 2D Farming RPG
This is just a simple 2D farming RPG game
Loading...
Searching...
No Matches
GenerateGUID.cs
Go to the documentation of this file.
1using UnityEngine;
2
7[ExecuteAlways]
8public class GenerateGUID : MonoBehaviour
9{
10 [SerializeField]
11 private string m_GUID = "";
12
13 public string GUID { get => m_GUID; set => m_GUID = value; }
14
18 public void Awake()
19 {
20 // Only populate in the editor
21 if( !Application.IsPlaying(gameObject) )
22 {
23 // Ensure that the object has a guaranteed unique id
24 if( m_GUID == "" )
25 {
26 m_GUID = System.Guid.NewGuid().ToString();
27 }
28 }
29 }
30}
Assign a unique GUID for the objects. These ids are used to retrive the gameobjects when restoring sc...
Definition: GenerateGUID.cs:9
string m_GUID
Definition: GenerateGUID.cs:11
void Awake()
Ensure that the object has a guaranteed unique id
Definition: GenerateGUID.cs:18