Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add cloth and runtime
#2
(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.
Reply


Messages In This Thread
Add cloth and runtime - by renderlux - 17-06-2020, 03:54 PM
RE: Add cloth and runtime - by josemendez - 17-06-2020, 05:07 PM
RE: Add cloth and runtime - by renderlux - 18-06-2020, 10:12 AM
RE: Add cloth and runtime - by josemendez - 18-06-2020, 10:14 AM
RE: Add cloth and runtime - by renderlux - 18-06-2020, 02:34 PM
RE: Add cloth and runtime - by josemendez - 18-06-2020, 03:40 PM