KEngine.AppEngine.PreloadConfigs C# (CSharp) Method

PreloadConfigs() public static method

Ensure Configs load
public static PreloadConfigs ( bool forceReload = false ) : EngineConfigs
forceReload bool
return EngineConfigs
        public static EngineConfigs PreloadConfigs(bool forceReload = false)
        {
            if (_engineConfigs != null && !forceReload)
                return _engineConfigs;

            string configContent = null;
            if (Application.isEditor && !Application.isPlaying)
            {
                // prevent Resources.Load fail on Batch Mode
                var filePath = "Assets/Resources/AppConfigs.txt";
                if (File.Exists(filePath))
                    configContent = System.IO.File.ReadAllText(filePath);
            }
            else
            {
                var textAsset = Resources.Load<TextAsset>("AppConfigs");
                if (textAsset != null)
                    configContent = textAsset.text;
            }

            _engineConfigs = new EngineConfigs(configContent);
            return _engineConfigs;
        }