[Player][Interactions] Pulver moves to item and goes back. Item disappears, but in wrong order
This commit is contained in:
@@ -7,8 +7,12 @@ public class LevelSwitch : MonoBehaviour
|
||||
public SpriteRenderer iconRenderer;
|
||||
private Interactable interactable;
|
||||
|
||||
private bool _isActive = true;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
_isActive = true;
|
||||
|
||||
if (iconRenderer == null)
|
||||
iconRenderer = GetComponent<SpriteRenderer>();
|
||||
|
||||
@@ -51,11 +55,12 @@ public class LevelSwitch : MonoBehaviour
|
||||
private async void OnInteracted()
|
||||
{
|
||||
Debug.Log($"LevelSwitch.OnInteracted: Switching to level {switchData?.targetLevelSceneName}");
|
||||
if (switchData != null && !string.IsNullOrEmpty(switchData.targetLevelSceneName))
|
||||
if (switchData != null && !string.IsNullOrEmpty(switchData.targetLevelSceneName) && _isActive)
|
||||
{
|
||||
// Optionally: show loading UI here
|
||||
var progress = new Progress<float>(p => Debug.Log($"Loading progress: {p * 100:F0}%"));
|
||||
await SceneManagerService.Instance.SwitchSceneAsync(switchData.targetLevelSceneName, progress);
|
||||
_isActive = false;
|
||||
// Optionally: hide loading UI here
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user