Beispiel #1
0
        /// <summary>
        /// Updates the scene index and enabled flags of a scene property by
        /// scanning through the scenes in EditorBuildSettings.
        /// </summary>
        private void UpdateSceneState()
        {
            if (sceneAsset != null)
            {
                var sceneInBuild = SceneReferenceUtils.GetSceneInBuildState(sceneAssetGUID);

                sceneIndex.intValue = sceneInBuild.Index;
                if (sceneInBuild.Present)
                {
                    sceneEnabled.boolValue = sceneInBuild.Enabled;
                    if (sceneInBuild.Enabled && sceneName.stringValue != sceneAsset.name)
                    {
                        sceneName.stringValue = sceneAsset.name;
                    }
                }
            }
            else
            {
                sceneName.stringValue = "";
            }
        }
Beispiel #2
0
        /// <summary>
        /// Validate any new values in the scene property. This will display
        /// popup errors if there are issues with the current value.
        /// </summary>
        private void Validate()
        {
            if (sceneAsset != null)
            {
                var buildScene = SceneReferenceUtils.GetSceneInBuildState(sceneAssetGUID);

                sceneIndex.intValue = buildScene.Index;
                if (buildScene.Enabled)
                {
                    if (sceneName.stringValue != sceneAsset.name)
                    {
                        sceneName.stringValue = sceneAsset.name;
                    }
                }

                DisplaySceneErrorPrompt(!buildScene.Present ? ERROR_SCENE_MISSING : ERROR_SCENE_DISABLED);
            }
            else
            {
                sceneName.stringValue = "";
            }
        }