How to optimize this script to render 1 millions of cubes in same screen?:

How to optimize this script to render 1 millions of cubes in same screen? Here’s my code:

1 Like
  1. Do it in c++ if possible
  2. Chunk the loop (ie spawn 100 per frame rather than all at once)
  3. Use InstancedStaticMeshs
  4. Possibly use an AsyncThread
2 Likes

(post deleted by author)

1 Like

you mean like Visual Studio or Rider? both are free now

it simply means instead of looping 1million times (which will give you an infinite loop error), loop 100 times, delay until next frame, loop 100 times etc.

this requires c++ too but basically it uses a seperate thread so the main game thread doesnt freeze

1 Like

(post deleted by author)

This is (often) more expensive than regular LODs.

If you remove “in C++” it will be more honest. :melting_face:
Everything can break at any moment, so you just need to make backups and you can save on antidepressants.

( ͡° ͜ʖ ͡°)
It seems that you have never had your blueprints break after changing the blueprint structures?)

I assure you, once you understand what possibilities C++ gives you (and what, alas, Blueprint does not have and is unlikely to have) - you will not be able to refuse it. In addition, you can (should) extend the capabilities of Blueprint itself using C++, so that the development process is as enjoyable as possible.

*HierarchicalInstancedStaticMeshs

This is definitely what you need.
You may need to split all meshes into multiple HISM components to get better performance.

Yes, yes, i will try on my another computer. I cant access to it for the moment, and i will code the hierarchical algorith or command enabling C++ in my another computer. For the moment im waiting before 3 of July of 2025…

C++ is the best code for many programmers and its used in mechanisms, 3d printing or games…

For the moment, i have a PC compatible only with community, doesnt support unreal + CPP coding. But yes, i know this method is the best. I want to get my unreal engine 5.6.0 work with C++.

Currently, C++ is unreachable with unreal engine 5.6.0 in the portable computer that I have. When i return to my parent’s main house, I maybe will reach C++ with unreal engine… but for moment, its impossible…

you dont need c++ for HierarchicalInstancedStaticMeshs which will give you the biggest performance boost.

same with breaking the loop up if you get freezes/infinite loop errors