public void Restore(RestorePostProcess postProcess, Action <Transform[]> callback) { postProcess.Register(root => { var identifiers = root.GetComponentsInChildren <Identifier>(); var transforms = gameObjectInstanceIDs .Select(gameObjectInstanceID => identifiers.FirstOrDefault(id => id.gameObjectInstanceID == gameObjectInstanceID)) .Select(obj => obj.transform) .ToArray(); callback(transforms); }); }
public void Restore(RestorePostProcess postProcess, Action <T> callback) { postProcess.Register(root => { var referenceObject = root.GetComponentsInChildren <Identifier>().FirstOrDefault(id => id.gameObjectInstanceID == gameObjectInstanceID); if (referenceObject != null) { callback(referenceObject.GetComponent <T>()); } else { Debug.LogWarning($"Reference Not Found: {typeof(T).FullName} ({gameObjectInstanceID})"); } }); }