I am using CSG (Constructive Solid Geometry) to create a mesh on runtime. The mesh is given a MeshCollider component and collisions work fine. I tried to add an InkCanvas component but it was causing an exception.
NullReferenceException: Object reference not set to an instance of an object Es.InkPainter.InkCanvas.InitPropertyID () (at Assets/InkPainter/Script/Core/InkCanvas.cs:323) Es.InkPainter.InkCanvas.Awake () (at Assets/InkPainter/Script/Core/InkCanvas.cs:265) UnityEngine.GameObject:AddComponent() ObstacleGeneratorV2:Start() (at Assets/Scripts/ObstacleGeneratorV2.cs:26)
The InkCanvas is added after the MeshCollider. Here is a part of the code:
Model result = CSG.Subtract(bigGameObject, smallGameObject);
var composite = new GameObject();
composite.tag = "Obstacle";
composite.AddComponent<MeshFilter>().sharedMesh = result.mesh;
composite.AddComponent<MeshCollider>().sharedMesh = result.mesh;
composite.AddComponent<MeshRenderer>().sharedMaterials = result.materials.ToArray();
composite.AddComponent<InkCanvas>();
composite.transform.parent = this.transform;
Am I adding the component wrong or it's not possible for it to be added on runtime.
I am using CSG (Constructive Solid Geometry) to create a mesh on runtime. The mesh is given a MeshCollider component and collisions work fine. I tried to add an InkCanvas component but it was causing an exception.
NullReferenceException: Object reference not set to an instance of an object Es.InkPainter.InkCanvas.InitPropertyID () (at Assets/InkPainter/Script/Core/InkCanvas.cs:323) Es.InkPainter.InkCanvas.Awake () (at Assets/InkPainter/Script/Core/InkCanvas.cs:265) UnityEngine.GameObject:AddComponent() ObstacleGeneratorV2:Start() (at Assets/Scripts/ObstacleGeneratorV2.cs:26)
The InkCanvas is added after the MeshCollider. Here is a part of the code:
Am I adding the component wrong or it's not possible for it to be added on runtime.