Skip to content

Commit 680a05f

Browse files
committed
✨ Add a function to get an action by id
1 parent 67056c8 commit 680a05f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

InteropUnityCUDA/Assets/Actions/InteropHandler.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,23 @@ protected void RegisterActionUnity(ActionUnity action, string actionName)
182182
_actionsNames.Add(actionName, key);
183183
_registeredActions.Add(key, action);
184184
}
185-
185+
186+
/// <summary>
187+
/// Get action unity
188+
/// </summary>
189+
/// <param name="actionName">name associated to this action</param>
190+
/// <returns>the action to get</returns>
191+
protected ActionUnity GetActionUnity(string actionName)
192+
{
193+
if (_actionsNames.TryGetValue(actionName, out int key))
194+
{
195+
return _registeredActions[key];
196+
}
197+
198+
Debug.LogError("Unable to find any action with this name : " + actionName);
199+
return null;
200+
201+
}
186202

187203

188204
/// <summary>

0 commit comments

Comments
 (0)