Search Unity

Question Where to view the generated code by [GenerateAuthoringComponent]?

Discussion in 'Entity Component System' started by davenirline, Oct 10, 2022.

  1. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    987
    I'm in the process of upgrading our project to 1.0. I'm having problems in the "remove GenerateAuthoringComponent" step. I'd like the entity references to still be correct. Before I proceed, I'd like to see generated authoring component and try to use that to see if it keeps the references. I'm talking about this part:
     
  2. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    992
    look into :
    %PROJECT_PATH%\Temp\GeneratedCode\Assembly-CSharp

    Code (CSharp):
    1. using System;
    2. using Unity.Entities;
    3.  
    4. [GenerateAuthoringComponent]
    5. [Serializable]
    6. public struct Prefab : IComponentData
    7. {
    8.     public Entity value;  
    9. }
    10.  
    turns into :


    Code (CSharp):
    1. #line 1 "C:\GitHub\Project\Temp\GeneratedCode\Assembly-CSharp\Prefab__AuthoringComponent_1404783755.g.cs"
    2. [UnityEngine.DisallowMultipleComponent]
    3. [global::System.Runtime.CompilerServices.CompilerGenerated]
    4. [System.SerializableAttribute]
    5. public class PrefabAuthoring : UnityEngine.MonoBehaviour, Unity.Entities.IConvertGameObjectToEntity, Unity.Entities.IDeclareReferencedPrefabs
    6. {
    7.     public UnityEngine.GameObject value;
    8.     public void Convert(Unity.Entities.Entity __entity, Unity.Entities.EntityManager __dstManager, GameObjectConversionSystem __conversionSystem)
    9.     {
    10.         Prefab component = default(Prefab);
    11.         component.value = __conversionSystem.GetPrimaryEntity(value);
    12.         __dstManager.AddComponentData(__entity, component);
    13.     }
    14.  
    15.     public void DeclareReferencedPrefabs(global::System.Collections.Generic.List<UnityEngine.GameObject> __referencedPrefabs)
    16.     {
    17.         Unity.Entities.Hybrid.Internal.GeneratedAuthoringComponentImplementation.AddReferencedPrefab(__referencedPrefabs, value);
    18.     }
    19. }
     
    davenirline likes this.
  3. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    987