Hello everybody! I would like to share my solution for using portals.
I created a small map, something like Mount & Blade.
To return to the map, near the village (or other place that was entered), I added a field with the name of the portal to the script, and I search for it.
I would like to know your opinion, is this decision correct?
[SerializeField]int nextScene;
[SerializeField] Transform spawnPoint;
[SerializeField] string portalName;
Portal GetOtherPortal()
{
foreach (var portal in FindObjectsOfType<Portal>())
{
if (portal.name == portalName) return portal;
}
return null;
}