Hi, I’m trying to compare all my LineRenderers with each other and see if there’re any dublicated LineRenderers with same values but this code destroys all:
public void RemoveDublicated () {
//get all drawn lines
LineRenderer[] lines = GameObject.FindObjectsOfType <LineRenderer>();
for (var i = 0; i < lines.Length; i++) {
var store = lines *.GetComponent <StoreLineRenderValues> ();*
-
//remove dublicated paintings*
-
if (i > 0) {*
-
for (var j = 0; j < lines.Length; j++) {*
-
var lastStore = lines [j].GetComponent <StoreLineRenderValues> ();*
-
if (store.theColor == lastStore.theColor && store.savedPos.Length == lastStore.savedPos.Length &&*
-
store.width == lastStore.width) {*
-
Destroy (store.gameObject);*
-
print (store.name + " Destroyed");*
-
}*
-
}*
-
}*
-
}*
- }*