RPG portal PlayerController Destroyed problem

When going into Scene 2 there is no problem
When coming back from scene 2 to scene 1 from any portal it gets in a loop same problem that had in this post

I have the same code like in the post it was there already before
Also i notice that the helmet i have that it is a StatsEquipableItem
Is not going to scene 2 not in inventory and not inside the eqiupment
The weapons which are also EquipableItem can pass fine
i tried creating the Core prefab again with the Updated player with Inventory and Stats Equipment on him

And it is the same

Hope someone can help

Edit i solved it ,
i had a problem with the collider

I keep this open for the problem with the StatsEquipableItem not moving to scenes
and weapons which are EquipableItem are moving fine
Another bug of ActionStore Duplicating while save and load from the game
Another bug of PickupSpawner if you take the items from one scene then go to the next scene
go back to scene that you took the items and Load the items come back

Everything is Solved

1.StatsEquipable Item - Wasnt inside Resource Folder ( make sure its in Resource Folder )
2.Action Store - Added Clear for the Dictionary see Below the code
3.Items coming back in Load with In the game - Changed in Portal.cs that it saves right before it destroy the portal see Below the code
4. Make sure your portals colliders arent interfering with the spawning point will make a loop that never ends and go crazy spawns in weird places

Code for stuff
2. Action Store

 void ISaveable.RestoreState(object state)
        {
            dockedItems.Clear();
            var stateDict = (Dictionary<int, DockedItemRecord>)state;
            foreach (var pair in stateDict)
            {
                AddAction(InventoryItem.GetFromID(pair.Value.itemID), pair.Key, pair.Value.number);
            }
        }

3.Portal.cs updated

private IEnumerator Transition()
        {
            if (sceneToLoad <0)
            {
                Debug.LogError("Scene to load not set.");
                yield break;
            }
            
            DontDestroyOnLoad(transform.root.gameObject);

            Fader fader = FindObjectOfType<Fader>();
            SavingWrapper savingWrapper = FindObjectOfType<SavingWrapper>();
            PlayerController playerController = GameObject.FindWithTag("Player").GetComponent<PlayerController>();
            playerController.enabled = false;
            //Remove control player

            yield return fader.FadeOut(fadeOutTime);

            
            savingWrapper.Save();

            yield return SceneManager.LoadSceneAsync(sceneToLoad);
            PlayerController newPlayerController = GameObject.FindWithTag("Player").GetComponent<PlayerController>();
            newPlayerController.enabled = false;
            //Remove control player

            savingWrapper.Load();

            Portal otherPortal = GetOtherPortal();
            UpdatePlayer(otherPortal);

            

            yield return new WaitForSeconds(fadeWaitTime);
            fader.FadeIn(fadeInTime);
            //Restore control player
            newPlayerController.enabled = true;
            savingWrapper.Save();
            Destroy(gameObject);
        }
1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms