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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.