I know it's not a requirement, but I just really feel the need to finish something, so I'm going to focus in and build up a fairly simple vertical that I should be able to scale out quickly. In particular, I'm going to make a little browser twin-stick, in the same vein as Wii Tanks.
(Screenshot from this video)
So here's how it went today (7/10/2019):
I fired up Unity Hub, downloaded 2019.3.0b6, and templated a new Universal RP project called "Just Tanks". Immediately tested a WASM build to see if it even works (historically I've never had a beta version actually produce a working WASM build), and it worked.. so far so good.
Next, fired up the package manager, scrolled through the preview packages, picking out all the ECS stuff I was pretty sure I needed. A LOT has changed since I first played with DOTS a few months ago, but I was pleasantly surprised to see most of the old methods I tried to use had unambiguous deprecation notes. Ended up getting confused that there seemed to be no mesh rendering component while writing code to spawn some test entities, and so I skimmed the ECS release notes to find that they moved the mesh renderer I was looking for into the "Hybrid Renderer" package. I don't completely know why, but it seems to have something to do with the scriptable render pipeline not being fully built for DOTS, and I guess that package has a bunch of tape and glue.
Now, here's where the trouble starts: From here, I looked over the current official ECS samples to see what's new, and noticed that most of the samples seem to be doing hybrid-y editor friendly things. For example, the samples seemed to be authoring GameObjects in the editor with regular components and writing a special MonoBehavior implementing "IConvertGameObjectToEntity" and sporting an ominous "[RequiresEntityConversion]" attribute. Then I remembered something from the talks I watched: Wasn't there just a script I could shove on pretty much anything and it'd do most of the ECS conversion work for me? Sure enough, I found "Convert to Entity", which I promptly slapped on my silly placement tank.
Alright, so looking at the Entity Debugger, at this point I had a couple of Entities getting built, and my little tank GameObject hierarchy was also properly converting into a pile of entities.
It was time to try another WASM build -- and BOOM out of bounds exceptions. I tried doing a debug build to get a legible trace, but no dice, we've got a Heisenbug on our hands. I spent the next 2 hours removing plugins and deleting code and rebuilding to figure out what caused it, with each WASM build taking > 10 minutes each. Turns out removing "Convert to Entity" fixes the problem. Taking a quick look, it's not doing anything too crazy, it's mostly just using utilities in "GameObjectConversionUtility", which is also how one of the ECS examples converts prefabs into Entities.
Anyways, that's all the time I have for today. I'll have to try some other conversion methods tomorrow, or failing that I'll just go with writing factories to generate entities per archetype. At least it's building now!
Bask in the professionalism of my 【cornflower blue】 .