Astra Unity 2.6.6
Astra Unity Plugin
Astra.Configuration Class Reference

Allows you to initialize and configure the Astra library using JSON, Astra.ProjectConfiguration, or direct calls More...

Classes

class  ProjectConfigJob
 Job used to track the initialization process of this project. Returns a boolean indicating a success, or a ProjectConfigError if an error occurred during initialization. More...
 

Public Types

enum  ProjectConfigError {
  Success , FailedToSetLogPath , FailedToSetLoggingEnabled , FailedToSetLogLevel ,
  FailedToSetDBPath , FailedToSetAppId , FailedToLogin , FailedToSetAppEnvironment
}
 Used to check for error types during initialization More...
 

Static Public Member Functions

static ProjectConfiguration ParseJSON (string text)
 Converts json text into a more usable class object ProjectConfiguration More...
 
static ProjectConfiguration ParseJSONFile (string path)
 A helper class that loads the JSON configuration file from disk and calls Configuration.ParseJSON(string) More...
 
static ProjectConfigJob InitializeFromJSON (string text)
 A helper class that loads the JSON configuration and calls Configuration.Initialize(ProjectConfiguration) More...
 
static ProjectConfigJob InitializeFromJSONFile (string path)
 A helper class that loads the JSON configuration file from disk and calls Configuration.InitializeFromJSON(string) More...
 
static ProjectConfigJob Initialize (UnityEngine.TextAsset asset)
 Triggers Initialize interally converting your text asset into json and parsing it More...
 
static void RecordLastAstraConfiguration (ProjectConfiguration config)
 Records the last Astra configuration used for this project. NOTE: does nothing if not in UnityEditor or if it's in play mode More...
 
static ProjectConfiguration GetCurrent ()
 Retrieves the most active configuration that has made it's way through the Initialize call. NOTE: This persists through serialization in Editor, so it's possible to have a configuration that has loaded in edit mode be valid in play mode even if in play mode one hasn't been initialized. More...
 
static ProjectConfigJob Initialize (ProjectConfiguration config)
 Sets up the application environment from ProjectConfiguration scriptable object. More...
 
static bool SetLogPath (string logPath)
 Set logging path More...
 
static string GetLogPath ()
 Returns logging path More...
 
static bool SetLoggingEnabled (bool enableLog)
 Turn on/off logging More...
 
static bool GetLoggingEnabled ()
 Returns whether logging is currently enabled More...
 
static bool SetLogLevel (LogLevel logLevel)
 Set log level More...
 
static LogLevel GetLogLevel ()
 Gets the currrent LogLevel of logging More...
 
static bool SetDBPath (string dbPath)
 Set DB path More...
 
static string GetDBPath ()
 Retrieves the current DB path
 
static void SetMainThreadUse (MainThreadUse mainThreadUse)
 Sets how much time the Astra job processing system is allowed to operate each frame.
 
static void SetNetworkLevel (NetworkLevel level)
 

Detailed Description

Allows you to initialize and configure the Astra library using JSON, Astra.ProjectConfiguration, or direct calls

Member Enumeration Documentation

◆ ProjectConfigError

Used to check for error types during initialization

Enumerator
Success 

No error occurred

FailedToSetLogPath 

A problem with the log path was detected, ensure the path is valid and you have write access to it

FailedToSetLoggingEnabled 

A problem enabling logging was detected, ensure the path is valid and you have write access to it

FailedToSetLogLevel 

A problem enabling log levels, check your Astra.LogLevel value

FailedToSetDBPath 

A problem with the db path was detected, ensure the path is valid and you have write access to it

FailedToSetAppId 

A problem setting the application id, ensure you have the right id from your web portal

FailedToLogin 

A problem logging in, ensure your username is valid if specified

FailedToSetAppEnvironment 

A problem occured communicating with the server, ensure your application namespace URI is accurate via the web portal

Member Function Documentation

◆ GetCurrent()

static ProjectConfiguration Astra.Configuration.GetCurrent ( )
inlinestatic

Retrieves the most active configuration that has made it's way through the Initialize call. NOTE: This persists through serialization in Editor, so it's possible to have a configuration that has loaded in edit mode be valid in play mode even if in play mode one hasn't been initialized.

Returns
The ProjectConfiguration is found, else null meaning no config has been loaded yet

◆ GetLoggingEnabled()

static bool Astra.Configuration.GetLoggingEnabled ( )
inlinestatic

Returns whether logging is currently enabled

Returns
true or false

◆ GetLogLevel()

static LogLevel Astra.Configuration.GetLogLevel ( )
inlinestatic

Gets the currrent LogLevel of logging

Returns
What the logging level is set to

◆ GetLogPath()

static string Astra.Configuration.GetLogPath ( )
inlinestatic

Returns logging path

Returns
logging path

◆ Initialize() [1/2]

static ProjectConfigJob Astra.Configuration.Initialize ( ProjectConfiguration  config)
inlinestatic

Sets up the application environment from ProjectConfiguration scriptable object.

Parameters
configProjectConfiguration scriptable object with member variables of settings to set
Returns
A job with the results

◆ Initialize() [2/2]

static ProjectConfigJob Astra.Configuration.Initialize ( UnityEngine.TextAsset  asset)
inlinestatic

Triggers Initialize interally converting your text asset into json and parsing it

Parameters
assetThe TextAsset which can be dragged into your behaviour or loaded from Resources.Load<TextAsset> or similar
Returns
A job you should wait upon to ensure the configuration has loaded successfully
//A typical JSON string might look like this
{
"app_id": 1,
"app_secret": "YOURSECRETKEY",
"app_environment": "https://YOURCOMPANY.maketafi.com",
"user_login": "",
"user_password": "",
"log_enabled": true,
"log_level": 300,
"log_path": "",
"db_path": ""
}

◆ InitializeFromJSON()

static ProjectConfigJob Astra.Configuration.InitializeFromJSON ( string  text)
inlinestatic

A helper class that loads the JSON configuration and calls Configuration.Initialize(ProjectConfiguration)

Parameters
pathThe path to your JSON config file
Returns
A Configuration.ProjectConfigJob job to wait upon completion

◆ InitializeFromJSONFile()

static ProjectConfigJob Astra.Configuration.InitializeFromJSONFile ( string  path)
inlinestatic

A helper class that loads the JSON configuration file from disk and calls Configuration.InitializeFromJSON(string)

Parameters
pathThe path to your JSON config file
Returns
A Configuration.ProjectConfigJob job to wait upon completion

◆ ParseJSON()

static ProjectConfiguration Astra.Configuration.ParseJSON ( string  text)
inlinestatic

Converts json text into a more usable class object ProjectConfiguration

Parameters
text
Returns

A Astra.ProjectConfiguration object

◆ ParseJSONFile()

static ProjectConfiguration Astra.Configuration.ParseJSONFile ( string  path)
inlinestatic

A helper class that loads the JSON configuration file from disk and calls Configuration.ParseJSON(string)

Parameters
pathThe path to your JSON config file
Returns
A Astra.ProjectConfiguration object

◆ RecordLastAstraConfiguration()

static void Astra.Configuration.RecordLastAstraConfiguration ( ProjectConfiguration  config)
inlinestatic

Records the last Astra configuration used for this project. NOTE: does nothing if not in UnityEditor or if it's in play mode

Parameters
path

◆ SetDBPath()

static bool Astra.Configuration.SetDBPath ( string  dbPath)
inlinestatic

Set DB path

Returns
true or false

◆ SetLoggingEnabled()

static bool Astra.Configuration.SetLoggingEnabled ( bool  enableLog)
inlinestatic

Turn on/off logging

Parameters
enableLogSet logging ienabled(true, false)
Returns
true or false

◆ SetLogLevel()

static bool Astra.Configuration.SetLogLevel ( LogLevel  logLevel)
inlinestatic

Set log level

Parameters
setLogLevelThe LogLevel to use
Returns
true or false

◆ SetLogPath()

static bool Astra.Configuration.SetLogPath ( string  logPath)
inlinestatic

Set logging path

Returns
true or false

The documentation for this class was generated from the following file: