Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Feedback Requirement based conversion workflow

Discussion in 'Works In Progress' started by WAYN_Games, Oct 6, 2019.

?

Do you find this simpler thant what you currently do ?

  1. Yes it's much simpler

    6 vote(s)
    100.0%
  2. Not realy, my current workflow is pretty similar

    0 vote(s)
    0.0%
  3. No, It's even more confusing, I think you have no idea what you are doing.

    0 vote(s)
    0.0%
  1. WAYN_Games

    WAYN_Games

    Joined:
    Mar 16, 2019
    Posts:
    521
    Hello,

    I love the fact that unity work on simplicity of use to avoid us writting boillerplate code for every components.

    I however don't like the fact that I have to add indivual authoring component to a game object and have to have the knowladeg of what component are requiered for the entity to behave a certain way. It's ok for a developper but as a disigner, I would be confused.

    So I came up with the following workflow :
    - Fore each data type I have an authoring component (the result of the [GenerateAuthoringComponent] intriduced at unite) (for instance Health or Attack)
    - Then for each system, I create a custom authoring component with the necessary [RequireComponent()] with the authoring composent type that represent the IComponentData used by the system.
    - Then I could have even higer level authoring component that reference the "system" authoring components in the [RequireComponent()]

    If you are interested, please check it out an dleave your comments and feed back here.

    https://github.com/WAYNGROUP/AutoringWorkflowDemo

    ConversionWorkflowWithGeneratedAuthoring

    Pros
    • Great granularity
    • Not duplicate components
    Cons
    • Data component don't provide any hint to the underlying systems
    ConversionWorkflowWithCustomAuthoring
    Pros
    • Custom authoring components give hint to the underlying systems and what can be expected in term of behaviour
    Cons
    • Require lots of additional coding.
    • Introduce the possibility to have duplicate data components.
    ConversionWorkflowWithRequireAuthoring
    Pros
    • Custom authoring components give hint to the underlying systems and what can be expected in term of behaviour
    • Very little coding required (just the system itself and a simple monobehaviour)
    • The Require attribute take care of avoiding duplicate component data
    Cons
    • Add additional components to the game object
    • Can be hard to clean up gameobject as inspector don't remove unnecessary data component when removing the Custom authoring ones.
    Solution to Cons:
    • Open the Windows > AuthoringComponentInspector :
      • this will provide a list of all data component with editable properties (synch with the classic inspector)
      • The AuthoringComponentInspector has a button to synchronize the authoring components of the game object with this inspector. It take into account newly added data component, removing the non required data component from the game object itself and add missing one if and existing custom authoring component was updated.
      • The sync can be made automatic within the Project Settings > Authoring Component Inspector Settings > Automatically sychronize data component
      • To clean the classic inspector, you can HideInInspector the generated data components using the toggle in Project Settings > Authoring Component Inspector Settings > Hide/Show data component in the inspector
     
    Last edited: Oct 27, 2019
  2. WAYN_Games

    WAYN_Games

    Joined:
    Mar 16, 2019
    Posts:
    521
    Updated the demo to allow the autosync feature to be controled through project settings

    The sync can be made automatic, just edit the script Editor > AuthoringComponentInspector to set autoSync = true.
    The sync can be made automatic within the Project Settings > Authoring Component Inspector Settings > Automaticaly sychronize data component

    Also added a setting to hide/show data components :

    - To clean the calssic inspector, you can HideInInspector the generated data components using the toggle in Project Settings > Authoring Component Inspector Settings > Hide/Show data component in the inspector
     
    Last edited: Oct 7, 2019
  3. WAYN_Games

    WAYN_Games

    Joined:
    Mar 16, 2019
    Posts:
    521
    Updated the github repository.

    Loads of refactoring
    Added a base class RequirementBasedAuthoringComponent with a custom inspector to display the required component data.
    Made any update to a field also update otehr field targeting the same data component on hte game object so wherever you edit the data values, they are always synched in the GUIs.



    Don't mind the exception at the end of the video. It's most likely due to how I handle the damage in this demo, I did not use a buffer but just an entity to convey the damage information so it does not support multiple damage per target.
    I'll fix it in a later udapte.
     
    nicolasgramlich likes this.
  4. WAYN_Games

    WAYN_Games

    Joined:
    Mar 16, 2019
    Posts:
    521
    Extracted the functionality to a git hosted unity pacakge.
    You can now import it through the package manager using this git URL :
    https://github.com/WAYNGROUP/UnityPackage-RequirementBasedAuthoringWorkflow.git

    The demo repository has been updated to reference this package.

    Upcoming changes will include :
    - proper namesapce for all scripts
    - refactoring to allow easy suport of additionnal data types like bool or lists for buffered elements.
     
  5. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,786
  6. WAYN_Games

    WAYN_Games

    Joined:
    Mar 16, 2019
    Posts:
    521
    twobob likes this.
  7. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,786
    Great. Might I also request you update the repo description at some point.
    From: "A repository to demonstrate how the require authoring conversion workflow word "
    To: "A repository to demonstrate how the Require authoring conversion workflow works "

    Enjoy your day
     
  8. WAYN_Games

    WAYN_Games

    Joined:
    Mar 16, 2019
    Posts:
    521
    Done.
     
    twobob likes this.
  9. WAYN_Games

    WAYN_Games

    Joined:
    Mar 16, 2019
    Posts:
    521
    Added partial support for List. for now, editing value of hte list elements are not applied.

    New issue found :
    - The workflow is not compatible with the prefabs, when editing data Unity does not register them as variants, so they are not applied by the conversion workflow.
    - Still need to expend coverage to other types like Color and stuff.
     
  10. WAYN_Games

    WAYN_Games

    Joined:
    Mar 16, 2019
    Posts:
    521
    Updated the packaged version.

    Move away from Visual element to go "back" to IMGUI.
    Used Serialized Object and Properties to get support for all data types (list, color, objects, primitives, ...)

    Need to figure out how to support object multi edit, if possible.
     
  11. WAYN_Games

    WAYN_Games

    Joined:
    Mar 16, 2019
    Posts:
    521
    Added support for auto generated authoring component with [GenerateAuthoringComponent]
     
unityunity