title: Unity: Collider not resizing with Sprite Shape by Script
body: <p>I built a Random Generated Mini Game with SpriteShape Prefabs. The Random Generator moves and changes the Spline of the SpriteShape. But the Edge Collider 2D refreses its size only when I click on the Instantiated Prefab on the Hirarchy.</p>
  
  <p>What can I do to Refresh the Collider</p>
  
  <hr>
  
  <p>This is the Scene when the World just generated. All Colliders are on the left side.
  <a href="https://i.stack.imgur.com/Rl4SR.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rl4SR.jpg" alt="enter image description here"></a></p>
  
  <hr>
  
  <p>This is the Scene after I clicked on the first 2 generated layers. The 2 Colliders Refreshed its size to the SpriteShape
  <a href="https://i.stack.imgur.com/VYbSn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VYbSn.jpg" alt="enter image description here"></a></p>
  
  <hr>
  
  <p>This is our code:</p>
  
  <pre><code>        GameObject currentLayer;
          Spline spline;
          int lastXPos = Random.Range(1, maxXPos-2);
  
          currentLayer = Instantiate(layer);
          currentLayer.transform.parent = gameObject.transform;
          currentLayer.transform.localPosition = new Vector3(0,-(2+i*2));
  
          spline = currentLayer.GetComponent&lt;SpriteShapeController&gt;().spline;
          spline.SetPosition(0, new Vector3(0, 0));
          spline.SetPosition(1, new Vector3(lastXPos, 0));
  </code></pre>