示例#1
0
        internal UnityEngine.Object Get(long id, Type type)
        {
            if (id == -1)
            {
                return(null);
            }
            UnityEngine.Object obj;
            if (!idRef.TryGetValue(id, out obj))
            {
                if (GlobalReferences != null)
                {
                    var globalRef = GlobalReferences.Get(id);
                    if (globalRef != null)
                    {
                        return(globalRef);
                    }
                }

                ES3Debug.LogWarning("Reference for " + type + " with ID " + id + " could not be found in Easy Save's reference manager. Try pressing the Refresh References button on the ES3ReferenceMgr Component of the Easy Save 3 Manager in your scene. If you are loading objects dynamically, this warning is expected and can be ignored.", this);
                return(null);
            }
            if (obj == null) // If obj has been marked as destroyed but not yet destroyed, don't return it.
            {
                return(null);
            }
            return(obj);
        }
示例#2
0
        internal UnityEngine.Object Get(long id, Type type, bool suppressWarnings = false)
        {
            foreach (var mgr in mgrs)
            {
                if (mgr == null)
                {
                    continue;
                }

                if (id == -1)
                {
                    return(null);
                }
                UnityEngine.Object obj;
                if (!mgr.idRef.TryGetValue(id, out obj))
                {
                    if (GlobalReferences != null)
                    {
                        var globalRef = GlobalReferences.Get(id);
                        if (globalRef != null)
                        {
                            return(globalRef);
                        }
                    }

                    if (type != null)
                    {
                        ES3Debug.LogWarning("Reference for " + type + " with ID " + id + " could not be found in Easy Save's reference manager. If you are loading objects dynamically (i.e. objects created at runtime), this warning is expected and can be ignored.", this);
                    }
                    else
                    {
                        ES3Debug.LogWarning("Reference with ID " + id + " could not be found in Easy Save's reference manager. If you are loading objects dynamically (i.e. objects created at runtime), this warning is expected and can be ignored.", this);
                    }
                    return(null);
                }
                if (obj == null) // If obj has been marked as destroyed but not yet destroyed, don't return it.
                {
                    return(null);
                }
                return(obj);
            }
            return(null);
        }
示例#3
0
        public long GetPrefab(ES3Prefab prefabToFind, bool suppressWarnings = false)
        {
            foreach (var mgr in mgrs)
            {
                if (mgr == null)
                {
                    continue;
                }

                foreach (var prefab in prefabs)
                {
                    if (prefab == prefabToFind)
                    {
                        return(prefab.prefabId);
                    }
                }
            }
            if (!suppressWarnings)
            {
                ES3Debug.LogWarning("Prefab with name " + prefabToFind.name + " could not be found in Easy Save's reference manager. Try pressing the Refresh References button on the ES3ReferenceMgr Component of the Easy Save 3 Manager in your scene.", prefabToFind);
            }
            return(-1);
        }
示例#4
0
        public ES3Prefab GetPrefab(long id, bool suppressWarnings = false)
        {
            foreach (var mgr in mgrs)
            {
                if (mgr == null)
                {
                    continue;
                }

                foreach (var prefab in mgr.prefabs)
                {
                    if (prefabs != null && prefab.prefabId == id)
                    {
                        return(prefab);
                    }
                }
            }
            if (!suppressWarnings)
            {
                ES3Debug.LogWarning("Prefab with ID " + id + " could not be found in Easy Save's reference manager. Try pressing the Refresh References button on the ES3ReferenceMgr Component of the Easy Save 3 Manager in your scene.", this);
            }
            return(null);
        }