#how do i make this work?
3 messages · Page 1 of 1 (latest)
The problem is not that you update model_scale inside the if's scope, but that you define it inside the if scope. You need to move the definition to somewhere accessible by both places.
Since this is done inside a system, you probably want to hold the actual value somewhere that survives between frames, If you just define it inside the function body, it'll get "reset" every time the system is called, which means you would only use the correct value if the user drops a dragged file on the exact same frame they clicked the button - which is probably not going to happen.
You are already doing something similar with ui_state - you are saving it inside a resource. You need to do the same with model_scale - save it inside a resource so that it persists between frames. Note that since you only use it in one system, you could also use Local instead of a resource. (Local would probably be a better choice for ui_state, as well)
BTW - is there a point in having the user click a "Save" button instead of just passing the value from ui_state to gen_dropped_pieces?
i had originally defined model_scale outside of the if scope, the problem was that it was always using that 1.0 value, and never reading the updated one