Skip to main content

Posts

Showing posts from October, 2024

A Complete Guide to Generating Entity Prefabs at Runtime in Unity ECS

Welcome back, everyone! As the title suggests, in this post, we’ll explore how to generate entities from prefabs at runtime. This is a crucial aspect of any game engine, as it allows for the dynamic creation of game objects during gameplay. Since this blog focuses on Unity ECS, I will explain how to generate entities at runtime using this system. Recap of previous posts: If you haven’t yet checked out the earlier posts, I’ve covered how to create and add components in Unity ECS , as well as the differences between standard components and custom ECS components. I highly recommend reading them, especially if you’re a beginner. In this blog, I will guide you on converting your non-ECS Unity project to Unity ECS and cover all related topics. I hope you’ve opened your ECS project. In the last couple of posts, I explained how to create entities from the editor, so do check those if you’re unfamiliar with the process. Once you’ve done that, you can start from