Yesterday, 03:25 PM
(This post was last modified: Yesterday, 03:38 PM by josemendez.)
(Yesterday, 01:20 AM)hariedo Wrote: Any luck in scripting a means to create a Rope Blueprint on the fly, that won't throw IORs?
Hi,
In your code you call LoadBlueprint() manually: just remove that line and the problem should be fixed.
Manually calling LoadBlueprint isn't needed in most cases -unless you're doing something out of the ordinary - as it's automatically called by ObiSolver at the right time as explained in the API docs. Calling it when the solver has not been initialized yet will result in index out of bounds, as the blueprint tries to access the (yet uninitialized) solver data arrays.
All you need for an actor to load a blueprint is to assign it, as the code examples in the manual show:
http://obi.virtualmethodstudio.com/manua...ctors.html
Doing:
Code:
rope.ropeBlueprint = yourBlueprint;
will automatically unload the previous blueprint (if any), clear internal state, and then load your new blueprint once the solver is ready. Note your script may also fail in Obi 6, as its success hinges on whether the solver's Start() is called before or after your TightRope's Start(). The order in which Unity calls events for different components is undefined by default.