11-05-2023, 03:08 PM
(This post was last modified: 11-05-2023, 03:08 PM by josemendez.)
Hi!
Cursors initialize their reference to the rope component in OnEnable(). Actors -such as ropes- are initialized in OnEnable() too, and get their OnBlueprintLoaded called.
Since the order in which Unity calls events for different components is undefined by default (the specific order might change between editor/runtime, and even between different runs of the same scene) chances are the cursor is attempting to change the length of the rope before its own OnEnable() event has been called, so the reference to the rope is still null.
A solution is to change the length of the rope in Start, instead of OnBlueprintLoaded. Start() is guaranteed to be called after OnEnable().
let me know if you need further help,
kind regards
Cursors initialize their reference to the rope component in OnEnable(). Actors -such as ropes- are initialized in OnEnable() too, and get their OnBlueprintLoaded called.
Since the order in which Unity calls events for different components is undefined by default (the specific order might change between editor/runtime, and even between different runs of the same scene) chances are the cursor is attempting to change the length of the rope before its own OnEnable() event has been called, so the reference to the rope is still null.
A solution is to change the length of the rope in Start, instead of OnBlueprintLoaded. Start() is guaranteed to be called after OnEnable().
let me know if you need further help,
kind regards