c# - Unity, removing a keycode that is already selected -
i have script has 2 public keycode variables developer can set. want accomplish when dev selects player attack "space" have next public keycode selection "interaction" not include "space" in selection trying accomplish no 2 keycodes can set same key.
i know put in place check in onvalidate , create warning in console needs changed. making tools developers want avoid road anyway possible , have them on rails wont break if makes sense.
fil list or array keys have been selected, , every selected key remove list/array.
then have new list or array keys can select.
you have rework little bit of in own way. (c# unity code)
using system; using system.collections.generic; public class keyselector { public list<keycode> selection; public void addkey(keycode) { selection.add(keycode); } public void removekey(keycode) { selection.remove(keycode); } //foreach keycode in selection (to make list dev can choose of) foreach(keycode key in selection) { //todo write code make list } }
Comments
Post a Comment