UseAction.HasActionKey
Declaration#
public virtual bool HasActionKey(string actionKey)Parameters#
| Name | Description |
|---|---|
| actionKey | Key of the action |
Description#
Check if plugin has action key
Usage#
using NullSave.GDTK.Inventory;using System.Collections.Generic;using UnityEngine;
public class Example : MonoBehaviour{
// Check if an item can run an action public void ExampleMethod(GDTKItem target, string actionName) { // Get all ItemPlugins List<ItemPlugin> plugins = target.GetPlugins<ItemPlugin>();
// Check each plugin until a match is found foreach (ItemPlugin plugin in plugins) { if (plugin.HasActionKey(actionName)) { Debug.Log(target.info.id + " has action " + actionName); return; } }
Debug.Log(target.info.id + " does not have action " + actionName); }
}