private static void BeforeSceneLoad()
        {
            var type     = typeof(UniBufSerializer);
            var property = type.GetField("_typeModel", BindingFlags.NonPublic | BindingFlags.Static);

            if (property == null)
            {
                throw new Exception($"Not found property \"TypeModel\" in {type}");
            }
            var typeModel = TypeModelFactory.CreateTypeModel(UnityAssembliesUtils.GetAllEditorTypes());

            property.SetValue(null, typeModel);
        }
예제 #2
0
        public void OnPreprocessBuild(BuildReport report)
        {
            UniBufConfig config = UniBufHelper.GetConfig();
            bool         isTest =
                (report.summary.options & BuildOptions.IncludeTestAssemblies) == BuildOptions.IncludeTestAssemblies;

            var typeModel = TypeModelFactory.CreateTypeModel(UnityAssembliesUtils.GetAllRuntimeTypes(isTest));

            if (config.AutoCompileModel)
            {
                UniBufHelper.CompileModel(typeModel);
            }

            if (config.AutoGenerateProtoFile)
            {
                UniBufHelper.GenerateProtoFile(typeModel, config.ProtoFilePath);
            }
        }
예제 #3
0
 private RuntimeTypeModel GetTypeModel()
 {
     return(TypeModelFactory.CreateTypeModel(UnityAssembliesUtils.GetAllRuntimeTypes(false)));
 }