FirstGearGames / FishNet

FishNet: Unity Networking Evolved.
Other
1.38k stars 147 forks source link

Regression of issue #270: SceneUnloadEndEventArgs doesn't contain unloaded scenes names #783

Closed FREEZX closed 1 month ago

FREEZX commented 1 month ago

General Unity version: 2022.3.23 Fish-Networking version: Discord link: N/A

Description The UnloadedScenesV2 / UnloadedScenes is not present in new versions of FishNet yet, and the SceneUnloadEndEventArgs has it as an unused property.

FirstGearGames commented 1 month ago

    /// <summary>
    /// Data container about a scene unload end.
    /// </summary>
    public struct SceneUnloadEndEventArgs
    {
        /// <summary>
        /// Queue data used by the current scene action.
        /// </summary>
        public readonly UnloadQueueData QueueData;
        /// <summary>
        /// Scenes which were successfully unloaded.
        /// This collection may be populated with empty scenes depending on engine version.
        /// </summary>
        [Obsolete("Use UnloadedScenesV2.")] //Remove on V5. Rename UnloadedScenesV2 to UnloadedScenes.
        public List<Scene> UnloadedScenes;
        /// <summary>
        /// Scenes which were successfully unloaded.
        /// This contains information of the scene unloaded but may not contain scene references as some Unity versions discard that information after a scene is unloaded.
        /// </summary>
        public List<UnloadedScene> UnloadedScenesV2;

        internal SceneUnloadEndEventArgs(UnloadQueueData sqd, List<Scene> unloadedScenes, List<UnloadedScene> newUnloadedScenes)
        {
            QueueData = sqd;
#pragma warning disable CS0618 // Type or member is obsolete
            UnloadedScenes = unloadedScenes;
#pragma warning restore CS0618 // Type or member is obsolete
            UnloadedScenesV2 = newUnloadedScenes;
        }
    }

Please try that.