Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reset rope starting shape?
#4
(13-02-2020, 02:54 PM)basilisk Wrote: Thank you, this works. But oddly, I am getting an error...


Code:
NullReferenceException: Object reference not set to an instance of an object

error at the line:


Code:
if (actor.isLoaded)

The rope shape is still being reset like I want even with this null error, so it works but I'd like to eliminate the error.


They way I've set it up is a public ObiActor myRope variable where I assign the rope GameObject in the editor, and when I want the rope to reset reset I pass myRope into...
Code:
void Reset(ObiActor actor)


Any idea why this null error is happening?

As far as your description goes, a null ref error in

Code:
if (actor.isLoaded)

can only indicate that "actor" is null. Maybe try using

Code:
if (actor != null && actor.isLoaded)

instead, if you plan on passing null sometimes? As to why is null being passed into the function, that's something I cannot know without looking at your actual code...
Reply


Messages In This Thread
Reset rope starting shape? - by basilisk - 13-02-2020, 12:18 PM
RE: Reset rope starting shape? - by josemendez - 13-02-2020, 01:11 PM
RE: Reset rope starting shape? - by basilisk - 13-02-2020, 02:54 PM
RE: Reset rope starting shape? - by josemendez - 13-02-2020, 05:15 PM
RE: Reset rope starting shape? - by basilisk - 13-02-2020, 06:04 PM