Obi Official Forum
Bug / Crash NullReference - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html)
+--- Thread: Bug / Crash NullReference (/thread-844.html)



NullReference - Evgenius - 29-01-2019

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


RE: NullReference - josemendez - 29-01-2019

(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();
    }



RE: NullReference - Evgenius - 29-01-2019

(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!