ScriptableObject.CreateInstance for subscene authoring data breaks Blob Asset allocation.

somehow managed to absolutely bork something that worked before. Right now, trying to “Reimport” a subscene that’s trying to allocate built blob array data will crash the headless LiveLink Unity instance (resulting in 6871412--801926--upload_2021-2-24_4-56-41.png being indefinitely displayed and the 6871412--801929--upload_2021-2-24_4-57-32.png subscene script never updating)

and taking out the authoring gameobject that’s causing this crash out of the subscene, attaching a ConvertToEntity component onto it and attempting to test it out in play mode will cause Unity to instantly crash.

in my code, i do everything for setting up Blob Asset data. and it will work all the way until you have to allocate it. in my specific instance, it’s a bunch of asset arrays. but once the process reaches the first instance of the blob builder allocation, it crashes. commenting out the allocation code will stop the crashing.

the allocation worked perfectly fine prior. In fact, it was good until i tried setting up a second subscene. the GameObjectConversion system was giving me errors in the subscenes conversion log, since the second subscene didn’t have the authoring gameobject within it, so there was no associated entity with the appropriate data (was using GetEntityQuery at the time). so I used Try/Catch to just, avoid that.

that was working fine. it was around this time i set up the authoring data via a ScriptableObject, and just had the authoring gameObject reference that instead. that worked fine too.

then I decided to see if I could get around Try-Catch without having to make sure each subscene had the same authoring gameobject in all of them, but still each having their own Blob Asset Reference. I believe this is where the mistake happened. instead of using an authoring gameobject, I just tried to create an instance of the Scriptable Object directly in the conversion system (ScriptableObject.CreateInstace<>() to be precise), and then tried using that SO in the system for the authoring data source.

I think that’s what caused the issue I have now. code that worked perfectly fine before, that i’ve even reverted back to, instantly crashes unity now.


Leaving the code in the section in the middle there will cause whatever Unity instance that runs it to crash atm, both LiveLink headless versions, or the main Unity instance. commenting out that code, and JUST that code, and everything will run perfectly fine again, albeit, without actually setting up any data in the blob asset cause it’s commented out.

also, my first forum post, so apologies so if this forum based bug report sucks?

Update. subscenes in general are borked apparently, not just BlobBuilderArray.

so… do not use ScriptableObject.CreateInstance<> within a gameObjectConversionSystem at the very least. Seems to break everything.6871445--801956--upload_2021-2-24_5-20-28.png
also: I’m getting these errors now when looking trying to do something with the subscenes. might have just been carelessly caused by closing them when they’re still updating or something like that. I can’t tell though, so…

6871460--801965--upload_2021-2-24_5-23-2.png
also… all subscenes removed from the main scene and I get this…

6871460--801965--upload_2021-2-24_5-23-2.png

update again:

had to reinstall the Entities package, rebuild the scriptable object script → instead of using serialized private fields with accessors, just basic public fields. blob constructor script using entities.foreach for good measure.

it seems to work properly again now. if it was just private scriptable object members that was causing the issues, it would confuse me, cause I did have it working while they were private… but alas. persistence

well well well. look who it is.

it’s me!

back at it again with another issue regarding subscenes, blob assets, and problems.

this time around, my issue is taking data from a scriptable object at time of conversion to store not in a blob asset, but basic component instead. just whenever a change is made to the scriptable object data, even though during debug.log testing, the data is available, it just simply is not actually updating the data to the actual component.

example: scriptable object default data is 1.2f. this gets set to the component during conversion time. scriptable object data is changed to 2.2f. running a debug.log command properly prints out 2.2f. however upon actual execution time the data is instead reverted to what it was before at 1.2f.

I know that this is Subscene related, because if i take out the authoring gameobject from the subscene it was held within, and completely reload the subscene to flush out the entities from the infringing authoring gameobject, and then put it back in to be converted again, the data gets properly set.

the entire “authoring vs runtime” paradigm Unity’s going seems to have a genuine flaw in execution at the moment, as changes made during authoring time do not appear to be properly getting changed when they should be at runtime.

want to provide clarification:

the debug.log provided in the main console of the editor is showing the proper, desired and expected result.

however

the subscene specific “conversion log” section, is only showing the old, unupdated data.