Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  NullReference
#1
Exclamación 
I'm trying to create a simple cloth, but no matter what I do, create my own or just copy/paste cloth (with solver and other components) from sample scene, I get an exception:

NullReferenceException: Object reference not set to an instance of an object
Obi.ObiCloth.AddToSolver (System.Object info) (at Assets/Obi/Scripts/Actors/ObiCloth.cs:167)
Obi.ObiActor.Start () (at Assets/Obi/Scripts/Actors/ObiActor.cs:163)

Debugging shows that the null is in the "topology.HalfEdgeMesh", but as I said, I just copied the existing and working cloth into another, almost empty scene (at least without any other Obi objects). There were no such a problem with 3.5
Reply
#2
(29-01-2019, 09:15 AM)Evgenius Wrote: I'm trying to create a simple cloth, but no matter what I do, create my own or just copy/paste cloth (with solver and other components) from sample scene, I get an exception:

NullReferenceException: Object reference not set to an instance of an object
Obi.ObiCloth.AddToSolver (System.Object info) (at Assets/Obi/Scripts/Actors/ObiCloth.cs:167)
Obi.ObiActor.Start () (at Assets/Obi/Scripts/Actors/ObiActor.cs:163)

Debugging shows that the null is in the "topology.HalfEdgeMesh", but as I said, I just copied the existing and working cloth into another, almost empty scene (at least without any other Obi objects). There were no such a problem with 3.5

Hi there!

Thanks for reporting this! Add the following code:
Code:
base.Awake();

in line 79 of ObiCloth.cs. This will ensure the Awake() method of ObiClothBase.cs is called and the topology set up properly for the copied object. The method should look like this:
Code:
public void Awake(){
        base.Awake();
        skinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>();

        FindRootboneBindpose();
        SetupAnimatorController();
    }
Reply
#3
(29-01-2019, 10:29 AM)josemendez Wrote: Hi there!

Thanks for reporting this! Add the following code:
Code:
base.Awake();

in line 79 of ObiCloth.cs. This will ensure the Awake() method of ObiClothBase.cs is called and the topology set up properly for the copied object. The method should look like this:
Code:
public void Awake(){
base.Awake();
skinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>();

FindRootboneBindpose();
SetupAnimatorController();
}

Thanks, now it works!
Reply