public static Entity Instantiate(EntityCommandBuffer.Concurrent ecb,
                                         int jobIndex,
                                         float3 target,
                                         Entity prefab,
                                         Entity prefabTrail,
                                         float3 pos,
                                         float3 vel,
                                         float time)
        {
            var entity = ecb.Instantiate(jobIndex, prefab);

            ecb.SetComponent(jobIndex, entity, new Translation {
                Value = pos,
            });
            var rot = quaternion.LookRotationSafe(vel, new float3(0, 1, 0));

            ecb.SetComponent(jobIndex, entity, new Rotation {
                Value = rot,
            });
            ecb.SetComponent(jobIndex, entity, new MissileComponent {
                Target = target, Velocity = vel,
            });
            ecb.SetComponent(jobIndex, entity, AlivePeriod.Create(time, 2f /* period */));
            TrailSystem.Instantiate(ecb, jobIndex, prefabTrail, entity /* refering_entity */, pos, 0.5f /* width */, new Color(0.8f, 0.8f, 0.8f), time);
            return(entity);
        }
        public static Entity Instantiate(Entity prefab, float3 pos, quaternion rot)
        {
            var em     = World.DefaultGameObjectInjectionWorld.EntityManager;
            var entity = em.Instantiate(prefab);

#if UNITY_EDITOR
            em.SetName(entity, "missile");
#endif
            em.SetComponentData(entity, new Translation {
                Value = pos,
            });
            em.SetComponentData(entity, new Rotation {
                Value = rot,
            });
            em.SetComponentData(entity, new MissileComponent {
                Target = new float3(0, 0, 0),
            });
            em.SetComponentData(entity, AlivePeriod.Create(UTJ.Time.GetCurrent(), 2f /* period */));
            TrailSystem.Instantiate(entity, pos, 0.5f /* width */, Color.white,
                                    new float3(0f, 0f, -0.5f) /* offset */, 4f / 60f /* update_interval */);
            return(entity);
        }