I have a very large CSV file (1 million+ rows) with four columns of data time
, id
, x
and y
. Here is a sample:
t id x y
434 84 0 0
435 84 28.22 -4.5
435 611 1895.13 755.17
435 872 2401.08 159.12
435 65 0 226.39
436 84 50.44 -4.5
436 611 1890.63 732.5
436 872 2373.9 151.04
436 990 2614.97 372.74
...
In my simulation, as time elapses I need to do one of three things:
If it's the first time an id has appeared, create an object with that id at the x,y coordinates
If an object with an id already exists update that object's x,y coordinates
If an id does not appear anymore delete that object
I'm guessing it's very intensive to keep a running timer, check the CSV every second, locate all rows with the current time and execute one of the above steps. Is there a more efficient way of dealing with time-series data in Unity simulations?