Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Is there a way to automate editor actions, like if the user was clicking on elements in the editor?

Discussion in 'Editor & General Support' started by rapidrunner, Aug 4, 2020.

  1. rapidrunner

    rapidrunner

    Joined:
    Jun 11, 2008
    Posts:
    944
    Probably I will get some replies that will tell me to use the Unity automation framework; but let me clarify here that I do not want to automate the game running in the editor, I want to automate the actual editor.

    Example: I would like to launch unity, and run automation so a project is set up as I defined in the automation (like load asset X and Y, get package XYZ from the package manager, load asset X in the scene, apply a material, change properties of the material and so on).

    Yes, I can do all of this manually, but I want to automate the process; especially because if I make a unity editor panel that I want to test, I can automate the testing instead, and save time (and sleep more hours). The objective is something similar to what you may see in automation frameworks like Selenium for webpages: you see the mouse moving, clicking and dragging interface elements on a DOM; change values in a textfield and so on.

    Unity editor has elements that can be automated, as far as UI; so I wonder if there are tools that are not advertised to do this, or if Unity has some API that allow you to access any element of the actual editor, either while in play mode or not, to not have to do all the manual work to move sliders, click buttons, load assets and such.
     
  2. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    rapidrunner likes this.
  3. rapidrunner

    rapidrunner

    Joined:
    Jun 11, 2008
    Posts:
    944
    Thanks; so fundamentally I have to call my own editor functions. that is pretty straightforward; I already do something similar for my other classes in my game, so I can do the same with the editor.

    I thought Unity would offer something more streamlined that would read a panel, get all the info from it and expose it in a way that you can address each element and change its parameters in a easy way, but clearly if it is as simple as call functions from the editor code, make sense that they didn't want to spend time on it