When I double click any ready-made blueprint node(ex: set actor rotation), a message that the node is reading from c++ is showed.
If I remember correctly, projects made only by blueprints call the Virtual Machine to convert blueprint lines to c++, making performance worse compared to projects using c++.
I got confused about the difference between using ready-made nodes and using c++ implemented nodes. Here’s an example:
I first made a function only using blueprints. This consists of many blueprint nodes such as ‘IsValid’, ‘Set Actor Rotation’, ‘Get Distance to’, ‘Add Actor Local Offset’. This function needs to be run every tick.
I implemented this function in c++, and set this function ‘BlueprintCallable’. Then I called this c++ function as a blueprint node and connected it with ‘Event Tick’.
My c++ implemented blueprint function seems to have nothing different with the pure blueprint version. It’s not different that both bring c++ codes to blueprint.
In order to achieve better performance using c++, should I put this function only in c++ Event Tick and never bring that to blueprint nodes? Or is it okay to bring this c++ implemented function to blueprint?
As long as that tick function isn’t on thousands of actors, I doubt there would be any performance difference between BP and CPP. Especially with a branch node at the start.
What you’re thinking of is called nativization. It would convert blueprints to native c++ through a virtual machine, allowing them to call native c++ functions. It’s effectively dead now due to the bad performance- It’s been completely removed in UE5. Apparently it was extremely buggy as well.
The “ready-made blueprint nodes” like set actor rotation aren’t using nativization or anything like that, they’re simply BlueprintCallable using the UFunction macro. They’re written in C++.
I’m not sure why it says “Reading from C++” in a project without generated cpp files, but if you have a cpp project, it will then open the parent class of that node in your IDE. Though it doesn’t work with K2 Nodes- which a lot of engine stuff like Actor uses. But you can still find the code for it- for example, the SetActorRotation node:
Thank you for your reply.
If the virtual machine is removed since UE5, what is making the difference on performance between c++ and blueprint? Is there something similar to virtual machine remaining yet?