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. Dismiss Notice

Resolved Unity integrated source/incremental generators

Discussion in 'Scripting Dev Blitz Day 2023 - Q&A' started by Hertzole, Feb 23, 2023.

  1. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    416
    With the rise of source (and the new incremental) generators, it would be a great addition to make these for our Unity workflows. They do already work in the recent versions, but actually making one is a bit of a pain.

    Right now you need to set up a separate project to build the generator in and then transfer that built generator to your project. It's not necessarily hard to do, just a bit annoying to get up and running.

    So will there be some way to make source generators like we make packages now, where we just provide the source code and Unity can build and use the generator for us? Like some kind of generator-specific assembly definition.

    I feel like this would make it much more accessible to make source generators and we would see an increase in generators in the Unity ecosystem.
     
  2. HaraldNielsen

    HaraldNielsen

    Unity Technologies

    Joined:
    Jun 8, 2016
    Posts:
    133
    Hi :) So yes, we are even having these pains internally, developing Source Generators / Analyzers in packages. So we can relate to your pain.
    We have a project undergoing, where we are moving to MSBuild, including csproj's, and including normal C# projects inside your Unity Solution, that will mean that you can have source generators part of that, and compiled as you would normally.
     
    cbauman, mariandev, bdovaz and 3 others like this.
  3. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    416
    Sounds awesome! And just for some clarification; would this mean we can share our source generators as normal UPM packages (with "raw source code") and they will just work™?
     
  4. HaraldNielsen

    HaraldNielsen

    Unity Technologies

    Joined:
    Jun 8, 2016
    Posts:
    133
  5. IC_

    IC_

    Joined:
    Jan 27, 2016
    Posts:
    61