Example #1
0
    private void OnFocus()
    {
        questsabers    = FindObjectsOfType <SaberReferences>();
        trail          = AssetDatabase.LoadAssetAtPath("Assets/Qosmetics Exporters/Saber specifics/Prefabs and Models/trailTemplate.prefab", typeof(UnityEngine.Object)) as GameObject;
        saberTemplate  = AssetDatabase.LoadAssetAtPath("Assets/Qosmetics Exporters/Saber specifics/Prefabs and Models/saberTemplate.prefab", typeof(UnityEngine.Object)) as GameObject;
        wallParticles  = AssetDatabase.LoadAssetAtPath("Assets/Qosmetics Exporters/Saber specifics/Prefabs and Models/wallParticles.prefab", typeof(UnityEngine.Object)) as GameObject;
        sliceParticles = AssetDatabase.LoadAssetAtPath("Assets/Qosmetics Exporters/Saber specifics/Prefabs and Models/sliceParticles.prefab", typeof(UnityEngine.Object)) as GameObject;
        try
        {
            string json = File.ReadAllText(exporterConfigPath);
            exporterConfig = JsonUtility.FromJson <ExportersConfig>(json);
        }
        catch (FileNotFoundException)
        {
            Debug.LogError("File at " + exporterConfigPath + " Could not be found! Remaking the file...");
            string newJson = JsonUtility.ToJson(new ExportersConfig(), true);
            File.WriteAllText(newJson, exporterConfigPath);
        }
        catch (DirectoryNotFoundException)
        {
            Debug.LogError("File at " + exporterConfigPath + " Could not be found! Remaking the file...");
            string newJson = JsonUtility.ToJson(new ExportersConfig(), true);
            File.WriteAllText(newJson, exporterConfigPath);
        }

        if (exporterConfig.allowOwnCamera)
        {
            cam = FindObjectOfType <QosmeticsCam>()?.gameObject.GetComponent <Camera>();
        }
    }
Example #2
0
 void OnFocus()
 {
     try
     {
         string json = File.ReadAllText(exporterConfigPath);
         exporterConfig = JsonUtility.FromJson <ExportersConfig>(json);
     }
     catch (FileNotFoundException)
     {
         Debug.LogError("File at " + exporterConfigPath + " Could not be found! Remaking the file...");
         string newJson = JsonUtility.ToJson(new ExportersConfig(), true);
         File.WriteAllText(newJson, exporterConfigPath);
     }
     catch (DirectoryNotFoundException)
     {
         Debug.LogError("File at " + exporterConfigPath + " Could not be found! Remaking the file...");
         string newJson = JsonUtility.ToJson(new ExportersConfig(), true);
         File.WriteAllText(newJson, exporterConfigPath);
     }
 }