Getting updated component values back into authoring component

I’m trying to create a tuning interface for my vehicle physics, and I’d like to use the input system to allow the user to interactively adjust various parameters while running the simulation. That bit is relatively easy – I just need to update the component value, which is something I’ve done elsewhere and can easily find example code for.

What I’d like to be able to do is copy those updated values back into the authoring component so I don’t need to manually update them (I intend to run the code in the editor). Is that even possible? I haven’t had any luck searching for an example. At the moment my plan is to just write out the values with some debug logging, but that’s not very elegant.

Hello,

I understand you have an authoring component that define the values for your vehicule physics.
You want, in editor, while play mode is active, to be able to tweak the parameter and see the result in real time and when you stop play mode keep the tweaked values.

Authoring data is not kept when stoping play mode, scriptable object values are.
I would try to make the autoring component depend on a scriptable object that contains the “vehicules physics profile” using Method DeclareAssetDependency | Entities | 0.17.0-preview.42
This should allow you to have the game object converted to an entity when the scriptable object is updated and the scriptable object should retian it’s values when existing play mode.

Using scriptable object may also allow you to define different vehicule profiles (race car, truck, …).

1 Like

Thanks! That sounds exactly like what I was looking for. I will give that a try in the next few days.