LeakzLP

can't read VehicleData.json

Recommended Posts

Hello ,i have a problem 

my VehicleData.json can't load , but i don't know why ?

I've put this file in Database/VehicleData.json

  class Vehicles : Script{

        public static List<VehicleData> vehicleDataList = new List<VehicleData>();

        public void LoadVehicleData() {

            if (!File.Exists(@"./Database/VehicleData.json")) {
                NAPI.Util.ConsoleOutput("[JSON] VehicleData konnte nicht geladen werden!");
                return;
            }
            
            string[] result = File.ReadAllLines(@"./Database/VehicleData.json");
            for(int i = 0; i < result.Length; i++) {
                VehicleData vehicleData = NAPI.Util.FromJson<VehicleData>(result[i]);
                vehicleDataList.Add(vehicleData);
            }
        }

I put my Database folder into resources/myProject/Database/VehicleData.json

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.