18-03-2018, 06:12 PM
(This post was last modified: 18-03-2018, 06:13 PM by josemendez.)
(18-03-2018, 06:04 PM)Gieve Wrote:The Full Error read out,Code:NullReferenceException: Object reference not set to an instance of an object
Obi.RopeMaker.AddPendulum (Obi.ObiCollider pendulum, Vector3 offSet)
(at Assets/Scripts/RopeMaker.cs:65)
RopeSetup.MakeRopes () (at Assets/Scripts/RopeSetup.cs:58)
RopeMakerEditor.OnInspectorGUI () (at Assets/Editor/RopeMakerEditor.cs:14)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex,
Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext,
UnityEngine.Rect& importedObjectBarRect)
(at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1253)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
points at line 65 the AddConstraint function call, and then refers back to all referencing code.
Are you waiting for the rope to be fully initialized before calling AddPendulum? There will be no pin constraint batches (or constraints of any kind, for that matter) before the initialization coroutine (MakeRope()) has finished... this is explained in the comments to that function:
Quote:/// MakeRope and AddPendulum may NOT be called on the same frame.
/// You must wait for the MakeRope coroutine to finish first.
/// Just adds a pendulum to the rope on the un-anchored end.