We are really interested by the whole DOTS stack, and were wondering if it was wise to go in real production yet.
We basically are developing quite a big game, and are most of all interested by the “SubScene” workflow and feature.
I’ve already managed to make it work on a prototype but we have some difficulties outside of the “streaming chunks of static meshes” consideration. Streaming scenes work and it is incredibly fast, but we encounter difficulties to (non exhaustive list) :
render animated skinned meshes
click on collider
have basic OnTrigger methods detect anything
To sum-up, we have difficulties to mix Subscene and “classic” stuff, and couldn’t find really usefull documentation.
I know that going full ECS won’t be a solution for now, but I wanted to know if it is viable to go hybrid at the moment.
And if so, I’d like to know what’s the status about these topics / how to integrate them in an ECS context :
AssetBundles
Basic Physics (raycasts / triggers)
Is it working on mobile (I guess cause megacity is) and consoles ?
We could be happy with “just” Subscenes, skinned mesh animations and basic physics…
DOTS will be coming out of beta and will be production ready by the end of this year I believe. And I would say it’s pretty safe to use it for production right now. I have been using for over a year now, and didn’t experience much churn with api changes over the past year. And with the new ConvertToEntity workflow, it makes it really easy and very viable to do a hybrid approach. And yes, it works for mobiles and consoles. And there is plenty of physics support for DOTS.
I think it’s ready for production in 2020 even though a lot of thing still not be confirmed (they’re listed as 2019.3/2020.1 experimental) such as LiveLink, DOTS Animation, DOTS Audio, etc. You can check from Unite Copehagen roadmap.
Thanks for your feedbacks.
My starting point is having scripts on objects inside a sub scene but si far I didn’t manage to make them work.
I’m trying to simply log something.
What am I doing wrong ?
using Unity.Entities;
public struct NpcSimpleAnimationData : IComponentData
{
}
using Unity.Entities;
using UnityEngine;
public class NpcBridge : MonoBehaviour, IConvertGameObjectToEntity
{
[SerializeField]
NpcSimpleAnimationData Data;
public void Convert(Unity.Entities.Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
Debug.Log("Try to convert..."); //this is executing when pressing "edit" button on the subscene
dstManager.AddComponentData(entity, Data);
}
}
using Unity.Entities;
using UnityEngine;
public class NpcSimpleAnimationSystem : ComponentSystem
{
private EntityQuery _npcGroup;
protected override void OnCreateManager()
{
_npcGroup = GetEntityQuery(typeof(NpcBridge));
Debug.Log(_npcGroup.CalculateLength());
}
protected override void OnUpdate()
{
var entities = _npcGroup.ToEntityArray(Unity.Collections.Allocator.Persistent);
var animators = _npcGroup.ToComponentArray<Animator>();
if(entities.Length > 0)
{
for(int i = 0; i < entities.Length; i++)
{
Debug.Log(animators[i]);
}
}
}
}
@Max_Lag When inside a sub-scene the conversion systems run once when you save the sub-scene and the result is saved in the asset created.
Also you are adding a component of type NpcSimpleAnimationData to the entity, but your ComponentSystem is not querying for that anywhere? Your system is instead looking for NpcBridge.
Isn’t Animator an old non-component class? I admit I haven’t used AddComponentObject, but can imagine the gameobjects only existing (temporarily) in the conversion world.
At least it’s not an ECS component so I doubt the query will work with it.
Try a round of eliminations? For example if you remove Animator from the query, do you then get your system to run?
P.S. If you aren’t aware then there is a brand new DOTS-based Animation system coming as a preview package very soon (a few weeks according to last info we saw).
Awesome, this is really the only must-have I need, to go forward in my prototype.
I can imagine workarounds for almost everything else but this might save me a lot of my time
I’ll wait for this package then, thanks ofr the answers.
To be honest I was trying to do as this guy did :
But with the SubScene black box context I guess it’s a bit more complex
Oh you’re using subscenes, yeah all GO in the end will be destroyed when subscene will be converted, and your Animator wouldn’t exists anymore. Moreover when you’ll try to add some component object to entity whle conversion (in GameObjectConversionSystem or through IConvertGameObjectToEntity) and rebuild entity cache or save this subscene data it should throw you error “Serialization of GameObject components is not supported for pure entity scenes”