#[1.2.0-pre.4/6] Cannot find TypeIndex for type hash (...)

1 messages · Page 1 of 1 (latest)

heavy ice
#

I'm getting the below error at runtime when building for Linux Dedicated Server with either IL2CPP or Mono. I found the Type with the given hash (struct InstanceData : IComponentData) and tried adding [UnityEngine.Scripting.Preserve] and forcefully using it in a MonoBehaviour but the error still happens.

Error when processing 'AsyncLoadSceneJob(/mnt/c/Users/jgraj/Desktop/DarkServerECS/Build/mono/dark_Data/StreamingAssets/EntityScenes/11751be4a2b6987498913ee414ddb1cc.0.entities)': Cannot find TypeIndex for type hash 2509569270566468138. Check in the debug file ExportedTypes.log of your project Logs folder (<projectName>/Logs) the corresponding Component type name for the type hash 2509569270566468138. And ensure your runtime depends on all assemblies defining the Component types your data uses.

#

I should probably also mention I have a main scene with a subscene that references two other scenes (and bakes them using new EntitySceneReference()) which get LoadAsynced and each of those scenes contains an aforementioned InstanceData attached to it

lyric minnow
#

go to that Logs folder

#

and find out which component it is

heavy ice
lyric minnow
#

In exactly same form as well

heavy ice
#

It's in the Assemby-CSharp.dll, I don't see why it's not in the build or how I can force it to be

#

Stripping is disabled, no IL2CPP either

lyric minnow
#

Any editor defines?

heavy ice
#

no

lyric minnow
#

Show that component

heavy ice
#
using Unity.Burst;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Physics;
using Unity.Transforms;

[BurstCompile]
[ChunkSerializable]
[UnityEngine.Scripting.Preserve]
public struct InstanceData : IComponentData {
    public uint id;
    public uint nextObjectId;
    public double startTime;
    public bool isDungeon;
    public NativeList<Entity> players;

  (... all methods here ...)
}```
#

in it's own file named InstanceData.cs

shut robin
#

ah yeah native list probably doesn't work

#

it has defines inside it for safety

#

wait hmm, maybe not true as i dont think it looks inside the components for stable hash calculation

#

but it would change the size of the component for serialization

heavy ice
#

I can probably convert it to a class as it acts as a singleton

#

If that helps anything

lyric minnow
#

Just move entities list to dynamic buffer

#

or add that component in runtime

shut robin
#

^ why isn't it just a dynamic buffer

lyric minnow
#

Baking is what causes issue

shut robin
#

using a native component here just causes all sorts of issues

lyric minnow
#

In runtime it'll be just fine

shut robin
#

still the pain of memory management

heavy ice
shut robin
#

they really should just put a static analyzer on baking if possible to just force disallow it

shut robin
heavy ice
#

this was on of the first dots code I wrote, poor me didnt even know about DynamicBuffer back then 😅

lyric minnow
#

And that's why people should just read manual first...

#

I bet you'll know a tons of good stuff if you haven't yet

heavy ice
#

I did try reading as much as I could but you gotta start practicing at some time 🥲

heavy ice
#

switching to DynamicBuffer fixed it