Search Unity

Question Shortcuts by code to Unity functions

Discussion in 'Editor & General Support' started by Vifi, Mar 1, 2021.

  1. Vifi

    Vifi

    Joined:
    Aug 5, 2013
    Posts:
    28
    Hi,
    do any of you know about making shortcuts from entire Unity functions by code?
    I mean, especialy i want to make buttons (or other controls like dropdown menu) in onscreen tool that will provide function from Window > Render Pipeline > Render Pipeline Debug Window > Material > Common Material Properties (dropdown menu). I want to bring that dropdown menu to my own editor window. Is there a way to do it?

    Thanks in advance ;)
    Cheeers
     
  2. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    For normal context menu items you can use
    https://docs.unity3d.com/ScriptReference/EditorApplication.ExecuteMenuItem.html
    if you want to access a Dropdown from inside of anohter editor you need to look at the reference code unity has up of its editor / the code for the renderpipline if that is specific to that.

    https://github.com/Unity-Technologies/UnityCsReference

    Reflection can help to access stuff that is not normally accessible , but keep in mind that this can break from version to version.