コード例 #1
0
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        var sectionEntity = conversionSystem.GetSceneSectionEntity(entity);

        //Second call to GetSceneSectionEntity should return same entity, else bail out making the test fail
        if (conversionSystem.GetSceneSectionEntity(entity) != sectionEntity)
        {
            return;
        }

        int sectionIndex = dstManager.GetSharedComponentData <SceneSection>(entity).Section;

        dstManager.AddComponentData(sectionEntity, new TestMetadata {
            SectionIndex = sectionIndex, Value = Value
        });

        dstManager.AddComponentData(sectionEntity, new TestMetadataWithEntity());
        dstManager.AddComponentData(sectionEntity, new TestMetadataWithBlobAsset());
        dstManager.AddSharedComponentData(sectionEntity, new EcsTestSharedComp());
        dstManager.AddBuffer <EcsIntElement>(sectionEntity);
        dstManager.AddComponentData(sectionEntity, new EcsState1());
        dstManager.AddComponent <TestMetadataTag>(sectionEntity);
#if !UNITY_DISABLE_MANAGED_COMPONENTS
        dstManager.AddComponentData(sectionEntity, new EcsTestManagedComponent());
#endif
    }
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        //Rather than adding runtime ToLoadSceneTag component to this entity,
        //find the corresponding subscene entity and add the component to that instead
        Entity sceneEntity = conversionSystem.GetSceneSectionEntity(entity);

        dstManager.AddComponentData(sceneEntity, new ToLoadSceneTag());
    }