GlobalObjectId in Runtime

Hey, everybody!
I’m new to Unity and have encountered the problem of getting a unique identifier for objects in a level.
At the moment I have this code implemented:

using UnityEditor;
using UnityEngine;

public class UUID : MonoBehaviour {
   
    [SerializeField] private string m_UUID = null;
   
    private void Awake() { 
      m_UUID = GlobalObjectId.GetGlobalObjectIdSlow(gameObject).ToString();
   }
   
    public string ID { get { return m_UUID; } }
}

This code works fine in Editor.
I need to modify it for Runtime version

I came across this component
https://docs.unity3d.com/Packages/com.unity.entities@1.3/api/Unity.Entities.Serialization.RuntimeGlobalObjectId.html

Please help me to rework the code so that it works in Runtime

2 Likes