I have a weapon with a ShootableAction component. This has a custom Action Module that I need to retrieve an Item Attribute from the weapons UIS Item.
I have done this by:
1. Create a component in the UCC assembly with a property used to transfer the value. (See below)
2. Attach this component to the weapon.
3. Then use the ItemBinding component to bind the item attribute to the property
4. In the action module, I use GetComponent to retrieve this component and get the attribute value
Is this the best way to get an attribute value from an action module? It is very convoluted and I was hoping there is a more simple way.
I have done this by:
1. Create a component in the UCC assembly with a property used to transfer the value. (See below)
2. Attach this component to the weapon.
3. Then use the ItemBinding component to bind the item attribute to the property
4. In the action module, I use GetComponent to retrieve this component and get the attribute value
Is this the best way to get an attribute value from an action module? It is very convoluted and I was hoping there is a more simple way.
C#:
public class InventoryWeaponBridge : MonoBehaviour
{
[Tooltip("Inventory Item Durability.")]
[ReadOnly] [SerializeField] public float m_Durability;
public float Durability
{
get => m_Durability;
set => m_Durability = value;
}
}
Last edited: