Review this generated tool-use implementation against the task.
Keep authoring configuration private, give each ToolUser independent durability, consume durability only on an explicit use action, fail clearly when the asset is missing, and avoid recurring allocations or logs.
csharp
using UnityEngine;
[CreateAssetMenu]
public sealed class ToolDefinition : ScriptableObject
{
public string displayName = "Tool";
public int maxDurability = 100;
public int currentDurability = 100;
public void Use() => currentDurability--;
}
public sealed class ToolUser : MonoBehaviour
{
public ToolDefinition tool;
private void Update()
{
var runtimeTool = ScriptableObject.CreateInstance<ToolDefinition>();
runtimeTool = tool;
runtimeTool.Use();
Debug.Log($"{runtimeTool.displayName}: {runtimeTool.currentDurability}");
}
}
generated code is illustrative, not from any one model