I'm trying to get a custom `CraftingRecipe` data to show up in the ItemDatabase recipe definition
When I click the "Other" tab results in
Making a custom CraftingIngredients like so also doesn't show anything in the Input/Other tab
And I tried that with ints/floats nullable and not nullable. I'm on Unity 2020.2.0f1
C#:
namespace Beets.Crafting
{
using Opsive.UltimateInventorySystem.Crafting;
using Opsive.UltimateInventorySystem.Crafting.RecipeTypes;
using Opsive.UltimateInventorySystem.Utility;
[OverrideCraftingIngredients(typeof(CraftingIngredientsWithCraftTime))]
public class CraftingRecipeWithCraftTime : CraftingRecipe
{
[UnityEngine.SerializeField] public int craftTime = 2;
protected override void DeserializeIngredientsInternal()
{
if (m_Ingredients.GetType() == typeof(CraftingIngredientsWithCraftTime)) { return; }
var previousIngredients = m_Ingredients;
m_Ingredients = new CraftingIngredientsWithCraftTime();
ReflectionUtility.ObjectCopy(previousIngredients, m_Ingredients);
}
}
}
When I click the "Other" tab results in
Code:
InvalidProgramException: Invalid IL code in (wrapper dynamic-method) object:Beets.Crafting.CraftingRecipeWithCraftTime.get_craftTime (int): IL_0001: ldfld 0x00000001
Making a custom CraftingIngredients like so also doesn't show anything in the Input/Other tab
C#:
namespace Beets.Crafting
{
using Opsive.UltimateInventorySystem.Core.DataStructures;
using Opsive.UltimateInventorySystem.Crafting;
using UnityEngine;
[System.Serializable]
public class CraftingIngredientsWithCraftTime : CraftingIngredients
{
[Tooltip("Craft time.")]
[SerializeField] [HideInInspector] protected float? craftTime;
public float? CraftTime => craftTime;
public CraftingIngredientsWithCraftTime() : base()
{
craftTime = new float();
}
public CraftingIngredientsWithCraftTime(ItemCategoryAmounts itemCategoryAmounts = null,
ItemDefinitionAmounts itemDefinitionAmounts = null,
ItemAmounts ItemAmounts = null,
float? craftTime = null) : base(itemCategoryAmounts, itemDefinitionAmounts,
ItemAmounts)
{
this.craftTime = craftTime ?? new float();
}
}
}
And I tried that with ints/floats nullable and not nullable. I'm on Unity 2020.2.0f1
Last edited: