Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

How do I add extra values to KeyCodes and other enums?

Discussion in 'Scripting' started by ChrisMG, Oct 26, 2018.

  1. ChrisMG

    ChrisMG

    Joined:
    Sep 21, 2018
    Posts:
    28
    I want to add extra values to the KeyCode enum, however all the answers I checked online tell me it's not possible because its not defined within my script so that I can directly change it.
     
  2. R1PFake

    R1PFake

    Joined:
    Aug 7, 2015
    Posts:
    507
    Well you already found your answer: It's not possible to add values to an already existing enum which isn't defined in your code.

    Which values would you want to add to the KeyCode enum anyways? Maybe there is a different solution for your problem.
     
  3. ChrisMG

    ChrisMG

    Joined:
    Sep 21, 2018
    Posts:
    28
    I want to add enums for dpad buttons instead of using axes'