Is it safe to convert static objects in my level to entities adding them to a subscene?

I don’t use DOTs or ECS in my game, but…
As far as I understand, if I add all of my static objects to a subscene, they’ll be converted to entities.
If the objects don’t have authored scripts (i.e. scripts written by me), I understand that all the rest of the components (i.e. the unity made components) will be automatically converted to the ECS counterpart. And I guess that just by having, say, all the mesh renders converted to ECS, they’ll be process faster as the memory will be better process and it’ll make use of multithreading, improving performance and maybe load times of all those objects and textures.
Is this right? would it also work with prefabs instances that don’t have authored scripts?

Sorry in advance in case i’m wrong, but from what you wrote it seems like you just read something and try to gain some arbitrary performance gain by doing something you know little about, which may hinder your progress in the future. So honestly, i dont recommend it.

Why do you want this performance gain (which i’ll come to below)? Is there a performance problem? If so, take a look at the profiler and spot the actual problem, then fix that, instead of applying random changes and hoping for an improvement. If not, dont do anything ‘just because’ and rather focus on creating your game. Fix performance after you spotted a real problem. Otherwise you often end up fixing things that may never have become a problem and waste your time.

I used some DOTS in the past. Unless you tackle a specific performance problem or specifically want to use it i would stay away from it. I dont know about subscenes, but if it was free of effort i assume you would have just tested it out instead of asking about the potential gains on the forum. Entities alone sure offer some performance gain, but it wont be anything tangible. I dont think there will be any difference in loading times, since ECS (data oriented programming) serves to better utilize the available CPU cache, while loading times are caused by stuff being loaded from the file system to your working memory (RAM). Lastly multithreading… i honestly never thought about that approach. Normally everything runs on the same thread, but any code run in ECS would probably implement their systems using jobs, which could potentially outsource some calculations to other threads. But i’m not sure if the performance gain for static objects is worth it. You dont really run anything on them. All a mesh renderer for static objects does is send the draw call / batches to the GPU, which is already optimized for static objects. Also, efficient memory management basically just means that data is organized with locality in mind. I’m really not an expert, but since most textures are larger than the low level CPU cache anyways, i dont think there is any benefit, and if there is it wont be noticable. And as far as i know, transfering models and textures to the GPU happens once, after which they are kept in VRAM, so the benfit should really be unnoticable.

So TL;DR:
i wouldnt recommend it. If you have a tangible performance problem, use the profiler to fix it. If not, dont do things just because. If you deem trying worth your time, make a copy of your project, test it and report back with the results.

Hope this helps a bit :slight_smile:

1 Like

For anyone wondering: you should check the features you’re using are compatible with the hybrid renderer. There’s a bunch of features it doesn’t support, and plataforms it can’t yet handle depending on what version you’re using.
https://docs.unity3d.com/Packages/com.unity.rendering.hybrid@0.4/manual/index.html
there’s also a StaticOptimizeEntity component.