Obi Official Forum

Full Version: NullReference
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
(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();
    }
(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!