Hi !
I’m pretty new to unity but already enjoying it.
I’m playing with tween and gameObject property. This very basic script allow one to have 3 connected object with the wonderfull vectrosity line editor.

This works perfectly, but… after a certain time of runtime the list where I store all my reference to the line got empty.

Here is the class bellow.
Please note that I encounter the problem everytime the app run more than few minutes.

Would be nice to get some help.

thank you,

using UnityEngine;
using Holoville.HOTween;
using System.Collections;
using System.Collections.Generic;
using Vectrosity; 


public class Line : MonoBehaviour {
	private List<VectorLine> connectionList = new List<VectorLine>();
	private int childrenNumber;
	
	[Range(1.01f, 1.10f)]
	public float variation;
	
	public Material lineMaterial;
	[Range(0.1f, 10.0f)]
	public float stroke;
	
	//private Material materialLine;
	
    void Start() {
		HOTween.Init(true, true, true);
		
		childrenNumber = this.transform.childCount;
		var linePoints = new Vector3[2];	
		if(childrenNumber >= 2){
			for(int i = 0; i < childrenNumber; i++){
					linePoints[0] = transform.GetChild(i).position;
					if(i < childrenNumber - 1){
						linePoints[1] = transform.GetChild(i+1).position;
					} else {
						linePoints[1] = transform.GetChild(0).position;
					}
					linePoints[0].z = linePoints[0].z + 0.2f;
					linePoints[1].z = linePoints[1].z + 0.2f;
					var lineName = "MyLine"+i;
					connectionList.Add(new VectorLine(lineName, linePoints, lineMaterial, stroke));
					connectionList*.Draw3D();*
  •  			HOTween.To(transform.GetChild(i), 3, new TweenParms()*
    
  •  	            .Prop("position", new Vector3(transform.GetChild(i).position.x + Random.Range(-0.50F, 0.50F), transform.GetChild(i).position.y + Random.Range(-0.50F, 0.50F), transform.GetChild(i).position.z + Random.Range(-0.50F, 0.50F)), false) // Position tween (set as relative)*
    
  •  	            .Loops(-1, LoopType.Yoyo) // Infinite yoyo loops*
    
  •  	            .Ease(EaseType.EaseInOutQuad) // Ease*
    
  •  	            .OnStepComplete(moveComplete, transform.GetChild(i).name) // OnComplete callback*
    
  •  	        );*
    
  •  	}		*
    
  •  }*
    

}

void Update() {

  •  childrenNumber = this.transform.childCount;*
    
  •  if(childrenNumber >= 2){*
    
  •  	if(connectionList.Count < childrenNumber){*
    
  •  		Debug.Log(connectionList.Count);*
    
  •  	} else {*
    
  •  		for(int i = 0; i < childrenNumber; i++){*
    

_ connectionList*.points3[0] = transform.GetChild(i).position;_
_
if(i < childrenNumber - 2){_
_ connectionList.points3[1] = transform.GetChild(i+1).position;
} else {
connectionList.points3[1] = transform.GetChild(1).position;
}
connectionList.points3[0].z += 0.2f;
connectionList.points3[1].z += 0.2f;
connectionList.lineWidth = stroke;
connectionList.Draw3D();
}
}
}
}*_

* void moveComplete(TweenEvent data){*
* if ( data.parms != null ) {*
* Debug.Log( data.parms[0] ); // outputs 1*
* }*
* Debug.Log(“complete”);*
* }*

* void OnMouseDrag() {*
renderer.material.color -= Color.white * Time.deltaTime;
}
}

I change the line :
private List connectionList = new List();

to :

 private List<VectorLine> connectionList ;

and I instantiate the list at Start…

this seams to fix the problem.

Thanks