How to Instantiate Prefabs in Unity DOTS (Convert Game Object to Entity)

preview_player
Показать описание
Let's check out how we can build Game Object Prefabs and Convert them into Entity Prefabs that we can then Instantiate.

Unity DOTS / ECS Tutorials

Getting Started with ECS

If you have any questions post them in the comments and I'll do my best to answer them.

See you next time!

#unitytutorial #unity3d #unity2d

--------------------------------------------------------------------

Hello and welcome, I am your Code Monkey and here you will learn everything about Game Development in Unity 2D using C#.

I've been developing games for several years with 7 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.

--------------------------------------------------------------------

Рекомендации по теме
Комментарии
Автор

Here's how you can still make Game Object Prefabs like you've always done and then convert them into super fast Entities!
🎮 Play 7 Awesome Games (Action, Strategy, Management) and Help Support the Channel!

CodeMonkeyUnity
Автор

If someone is wondering why she/he can't see the entities in scene or game view --> Install 'Hybrid Renderer' from the Package Manager.

MNenad
Автор

Awesome thanks!
I found the last (not the overkill) method to be the easiest to implement in my opinion rather than the first but maybe I'm missing something here.

Yukisando
Автор

Thanks for the video. Just something I needed. Also it is good to mention that `EntityManager.Instantiate()` method will NOT copy the components from the prefab in case you use it in Convert phase because those prefabs may not be converted yet. I just spent about an hour on it investigating, why the heck those spawned entities do not have desired components.

michalvysinsky
Автор

Hello Mr. Monkey! =) Thanks for your tutorials on such difficult topics. They are very helpful.

hanmayujiro
Автор

Is there a sane way to access entities and components from the gameobject world and the other way arround?
Making UI in dots is maddening!

ElementalCode
Автор

Danm it, this is the third time I relearn the absolute basics of ECS / jobs. Such a struggle to find any consistency over the years.
But with the automatically created jobs it seems to me like it finally starts to become the performance first solution they promised.
Does the entitie.foreach automatically use the burst compiler when scheduled?

KimboKG
Автор

Hi, thanks a lot for your tutorials.
I have a question, how do i spawn a prefab from the folder in runtime, is it necessary to have a gameobject with the 'convert' script added on the scene?

vladislavgrisuk
Автор

Informative video as always, thank you! Now that we are 6 months from this video, any thoughts on which method is "best" or is DOTS still changing too much to tell? Is there a major performance difference for any of these methods?

piginawig
Автор

In new ECS versions you cannot convert prefabs to entities unless you use prefab)`

bxbstudiodev
Автор

Remake this video pls, and everyone who sees the comment, pls bump it up!

Luciferdelight
Автор

[GenerateAuthoringComponent] is not available to me. I am using Unity.Entities and my entities package is up to date.


Edit: Forgot to update unity (to 2019.3.0f5). Updated the Entities Package and everything works fine.

LoLoLoLoLo
Автор

I don't see a tutorial about hybrid gameobject-entities from anyone.
Is it so uncommon thing to have a rigidbody that runs in ecs and syncs it's transform to a GameObject?
Could you make a tutorial about that? (i am not sure if i'm the only person who may want such a thing though)
EDIT: Oh you already made one about that here "Game Objects with Unity DOTS Pathfinding! (ECS mixed with MonoBehaviour)"

Thats great, thank you for making these.

puppetlord
Автор

Hi Code Monkey. I wanted to recreate my 2D simulation project in Unity DOTS for bigger scale. But I have one annoying issue. I imported all important packages entities, renderer etc. And when I try to use Convert To Entity component on cube or create entity with archetype It dissapears on playmode. I tried to search for answer on your comments and other videos, but sadly didn't found solution

DevKacper
Автор

Now my question is, what happens if the prefab already has scripts attached to it. Will they work? Will they turned into the ECS system?

dangeren
Автор

Thanks for the tutorial, I've followed it and it works.
Although it doesn't display anything on the screen when I want to add a RawImage. I create the prefab and automatically a canvas is created as parent of the RawImage. I can see the entities created in the Entity Debugger but nothing shows in the screen. What can I do?

miguelangelgalindo
Автор

Unity announced on November 15, 2023 that it would be discontinuing DOTS and ECS. Is this video still useful?

eduardovarela
Автор

Hello, when I put the convert to entity script onto a gameobject and enter playmode, unity crashes. Any idea why?

martingrof
Автор

the EntitySpawnerSystem is not a monobehaviour, so i cant add it to the GameObject

erikhorvath
Автор

If my gameobject prefab has a script on it which implements IConvertGameObjectToEntity, will that run when it is converted by these methods?

MichaelIZKOOL