Hello there!
Background: I have several cars in scene with SplineController on them an dI want to distribute them along path with code. To do so I just need to foreach them and change their Initial Positions.
I'm trying to change Spline Controller properties in Editor by code.
For example:
(It is executed by my button pressed in Editor Mode)
And I see the desired result.
But once I switch Unity to Play Mode, my changes are gone!
=============
If, after pressing my button but before going to Play Mode, I select my GameObject with SplineController and change something in the Inspector manually (doesn't matter what exactly, for example, switch off and then back on Play Automatically checkbox), the changes get saved.
=============
Obviously, Inspector does something after changes are done inside it, what my script does not.
But I wasn't able to figure out what exactly.
What should I do in code, in Editor Mode, to make my changes be saved without manually touching the Inspector?
Thank anyone for relative answer!
Background: I have several cars in scene with SplineController on them an dI want to distribute them along path with code. To do so I just need to foreach them and change their Initial Positions.
I'm trying to change Spline Controller properties in Editor by code.
For example:
Code:
float foo = 0.1f*bar;
splineController.InitialPosition = foo;
And I see the desired result.
But once I switch Unity to Play Mode, my changes are gone!
=============
If, after pressing my button but before going to Play Mode, I select my GameObject with SplineController and change something in the Inspector manually (doesn't matter what exactly, for example, switch off and then back on Play Automatically checkbox), the changes get saved.
=============
Obviously, Inspector does something after changes are done inside it, what my script does not.
But I wasn't able to figure out what exactly.
What should I do in code, in Editor Mode, to make my changes be saved without manually touching the Inspector?
Thank anyone for relative answer!