#Authoring questions

1 messages · Page 1 of 1 (latest)

steep phoenix
#

testing threads 🙂

dusty pilot
#

threads do work

steep phoenix
#

the mbs are just nice looking data. you can put pretty much anything on it. they are meant for designers. then the data is used by the Convert method and the actual data for the entities are built

#
using Unity.Entities;
using UnityEngine;

public struct SpawnerCasterComponent : IComponentData
{
    public Entity prefab;
    //public Entity prefab2;
    //public Entity prefab3;
    public int maxCount;
    public int spawnPerFrame;
    public int castSpellId;
}

public class SpawnerCaster_Authoring : MonoBehaviour, IConvertGameObjectToEntity, IDeclareReferencedPrefabs
{
    public GameObject prefab;
    public int maxCount;
    public int spawnPerFrame;
    public int castSpellId;

    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        dstManager.AddComponentData(entity, new SpawnerCasterComponent()
        {
            prefab = conversionSystem.GetPrimaryEntity(prefab),
            maxCount = maxCount,
            spawnPerFrame = spawnPerFrame,
            castSpellId = castSpellId
        });
    }

    public void DeclareReferencedPrefabs(List<GameObject> referencedPrefabs)
    {
        referencedPrefabs.Add(prefab);
    }
}```
#

yes, when you use an Entities.ForEach with a managed object, no multi threading either

#

but that's all only true when you have the managed object in the query

#

if you don't need access you still can have burst and multi threading

#

for your mob, I think quite a lot actually. The biggest problem is that entities still has no animator. that means an entity has to spawn a gameobject prefab with an animator

#

think of it as the entity that has the actual data and systems the code. the gameobject is only the presentation of it

#

the rest of the code you have now like movement, etc... would need a rewrite to a system

dusty pilot
#

ok yeah no that's too much work for little reward

steep phoenix
#

probably true but you can see it as learning experience to work with dots. it's easier to port existing code than to write new one. at least the goals are clear