playMaker

Author Topic: Does not support 2 actions with same name in different categories [SOLVED]  (Read 2204 times)

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
Scenario:
I have multiple actions which are named the same but target different controllers, for example I have a MoveTowardsNode which exists on ActionCategory for CharacterController and RigidBody, they are also both in different namespaces.

When I then go to use these in the editor it blows up with the error:
ArgumentException: An element with the same key already exists in the dictionary.

I would expect that this should not occur when they are in different action categories.

Acceptance Criteria For Fix:

Given I have an action named "MoveTowardsNode" in ActionCategory "Character"
And I have an action named "MoveTowardsNode" in ActionCategory "RigidBody"
When I go to view the actions in the action browser window
Then I should not get an exception
And I should see both actions in the list under different categories
« Last Edit: March 27, 2014, 04:16:33 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 It's indeed not possible currently. I would think that adding an attribute for a default action name different than the class name itself could be a way out, but indeed I think it would create more confusion in the end for developers.

Instead, make sure you name each action with a unique name ( the class name), so in your situation you should have:

RigidBodyMoveTowardsNode
CharacterMoveTowardsNode

OR

MoveTowardsNode that accept either a rigidbody or a Character, it's possible to do that too, even elegantly using a custom editor to let the user choose within the interface itself.

Categories are really abstract structuring for organization purpose, I personally hardly use categories, and instead always use the search field to get the exact action I need, so you would type in the search field, "Character move towards", and it would list only the right action. IF they where named the same, then this search would fail and would be a potential issue.

 I even myself got confused even with different action names, typically between photon and Unity networking, causing enormous headaches... because I failed to see that I was not using the right action... so if actions starts to have the same name, I can see a lot more trouble ahead.

 Also, you are aware that you can rename action once they are on the state, simply double click on the action name.


 Bye,

 Jean

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
I have just renamed them currently, but as they are already within the right category in the list the additional naming is redundant, but at least it works.

If you do not class it as a bug then feel free to close the issue.