Closed rc1 closed 8 years ago
What do you mean with 'Creates all the nodes whenever it calculates'? There is no copy made or anything, it is directly accessing the asset and performs the calculation on it. Or is this related to the debug that automatically gets called, in which case remove it if you don't need it, it wasn't meant to be called each frame and debug it anyways;) Please clarify this, thanks!
Steps to recreate:
RTCanvasCalculator
component to a GameObjectDebug.Log
in a Node's Create
methodCalculateCanvas
on every frameThe Debug.Log
will be called every frame.
RuntimeNodeEditor doesn't do this. I've tried to pick it apart... but just get lost in this.
Oh, ok so without trying I now know why. It is caused by #72, basically one node of each type is created on initiation, which is in the end bad design but I chose so when I first started this project to be able to overwrite the Create method for each node type (not possible with statics). Hard to overcome but that's the root cause. The problem that is most noticeable here is then caused by a different problem that is easier to fix. Node initiation consists of two parts, normal and GUI-related initiation, where GUI related initiation can only be called from OnGUI. When using the framework, it is initiating but as it wasn't called in GUI code it can't initiate the GUI, and currently that means it is still flagged as not initiated. So that's why a call to the framework each frame currently causes it to re-initiate each frame. I'll fix it and report back:)
Great. Thanks
Fixed in 786a804 :)
RTCanvasCalculator.cs
creates all the node whenever it calculates a canvas. So if it calculates every frame there's a significant drop in framerate.What's the proper way to calculate a canvas at runtime?