17-06-2020, 05:07 PM
(17-06-2020, 03:54 PM)renderlux Wrote: I'm trying to add ObiSkinnedCloth and reference skinnedClothBlueprint
var gameObj = meshObject.AddComponent<ObiSkinnedCloth>();
gameObj.skinnedClothBlueprint = ScriptableObject.Instantiate(SourceBlueprint.instance.sourceTop);
meshObject.AddComponent<ObiSkinnedClothRenderer>();
But I'm getting
NullReferenceException: Object reference not set to an instance of an object
I believe the problem is:
gameObj.skinnedClothBlueprint = ScriptableObject.Instantiate(SourceBlueprint.instance.sourceTop);
Well, this can only mean SourceBlueprint, SourceBlueprint.instance or SourceBlueprint.instance.sourceTop are null. I can't possibly know which one. Try debugging your code by placing a breakpoint at that line, and check what's raising the null ref exception.