Example #1
0
        public static CustomScriptAssemblyData FromJson(string json)
        {
            var assemblyData = new CustomScriptAssemblyWithLegacyData();

            assemblyData.autoReferenced = true;
            UnityEngine.JsonUtility.FromJsonOverwrite(json, assemblyData);

            assemblyData.UpdateLegacyData();

            if (assemblyData == null)
            {
                throw new System.Exception("Json file does not contain an assembly definition");
            }

            if (string.IsNullOrEmpty(assemblyData.name))
            {
                throw new System.Exception("Required property 'name' not set");
            }

            if ((assemblyData.excludePlatforms != null && assemblyData.excludePlatforms.Length > 0) &&
                (assemblyData.includePlatforms != null && assemblyData.includePlatforms.Length > 0))
            {
                throw new System.Exception("Both 'excludePlatforms' and 'includePlatforms' are set.");
            }

            return(assemblyData);
        }
        public static CustomScriptAssemblyData FromJsonNoFieldValidation(string json)
        {
            var assemblyData = new CustomScriptAssemblyWithLegacyData();
            assemblyData.autoReferenced = true;
            UnityEngine.JsonUtility.FromJsonOverwrite(json, assemblyData);

            UpdateRenamedReferences(assemblyData);
            assemblyData.UpdateLegacyData();

            if (assemblyData == null)
                throw new System.Exception("Json file does not contain an assembly definition");

            return assemblyData;
        }