playMaker

Author Topic: Read CSV overwrites other csv References  (Read 701 times)

Maximilian0

  • Playmaker Newbie
  • *
  • Posts: 33
Read CSV overwrites other csv References
« on: April 20, 2020, 07:15:13 AM »
Hi, I am using csv sheats in my current project to load unit values, chances and prices into my project and so far it worked wonderfully.
Now I have added two csv text files to my existing one and just repeated the process of Read Text Asset-> Read CSV-> Save in Global Variable for both.
The problem is that now every Read CSV action seems to overwrite the last one even though it reads a different file and saves it in a different variable. When I start the project I get error messages saying "csv reference does not have X columns only Y" which always matches the last read csv file, even though another one was supposed to be read.
Is it because there is only meant to be one single CSV file in a project, or maybe because of global variables?
Thanks
« Last Edit: April 20, 2020, 08:57:44 AM by Maximilian0 »

PlaymakerNOOB

  • Full Member
  • ***
  • Posts: 219
Re: Read CSV overwrites other csv References
« Reply #1 on: April 21, 2020, 12:33:22 PM »
My guess, your CSV reading logic is bugged as you have it somewhere copying CSV variable 1 and pasting it with CSV variable.
 Happens me far too often when I copy/paste code from one section to another.

I'd recommend just making your read CSV logic a prefab or template, and then just call it again for the 2nd, 3rd, 4th CSVs.
« Last Edit: April 21, 2020, 12:35:50 PM by PlaymakerNOOB »

Maximilian0

  • Playmaker Newbie
  • *
  • Posts: 33
Re: Read CSV overwrites other csv References
« Reply #2 on: April 22, 2020, 04:14:34 AM »
Hey, thanks for your reply. I tried to be very carefull and used different variables for each step, but you are probably right in your approach.

I solved it for now by writing every value in a single csv sheat and reading it at the appropriate records. Its a bit more unorganized but works so far.