Add Components at runtime
The asset wasn’t really designed with AddComponent in mind. Adding a SpringComponent in the Inspector, setting it up and optionally referencing it from some other script is always the ideal recommended use case.
But if, for some reason, you want or need to add a SpringComponent at runtime this is how you do it:
Add a SpringComponent in runtime
Setup the SpringComponent
Initialize the SpringComponent
Use it normally
Here 2 examples:
And:
You can find the full example from above in:
Assets\AllIn1SpringsToolkit\Demo\Scripts\ExampleAddComponent.cs
Last updated