From 7a1e098b9d80d7f100bd01ff89b8064455406036 Mon Sep 17 00:00:00 2001 From: ViliamVolosV Date: Tue, 17 Aug 2021 18:01:52 +0300 Subject: [PATCH] Add support bool and float in reflection baking Fix this exception for bool and float ZenjectException: Cannot process values with type currently. Feel free to add support for this and submit a pull request to github. --- .../Common/ReflectionBakingModuleEditor.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/UnityProject/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/ReflectionBakingModuleEditor.cs b/UnityProject/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/ReflectionBakingModuleEditor.cs index 4c4f0ace0..045f25418 100644 --- a/UnityProject/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/ReflectionBakingModuleEditor.cs +++ b/UnityProject/Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Common/ReflectionBakingModuleEditor.cs @@ -634,6 +634,17 @@ void AddObjectInstructions( instructions.Add(Instruction.Create(OpCodes.Ldc_I4, (int)identifier)); instructions.Add(Instruction.Create(OpCodes.Box, _module.Import(identifier.GetType()))); } + else if (identifier is float) + { + instructions.Add(Instruction.Create(OpCodes.Ldc_R4, (float)identifier)); + instructions.Add(Instruction.Create(OpCodes.Box, _module.Import(typeof(float)))); + } + else if (identifier is bool) + { + + instructions.Add(Instruction.Create(OpCodes.Ldc_I4, (bool)identifier ? 1 : 0)); + instructions.Add(Instruction.Create(OpCodes.Box, _module.Import(typeof(bool)))); + } else { throw Assert.CreateException(