Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

Binnary Formatter working nicely in editor - but I have crashing after scene load paramteras on both iOS and Android device

$
0
0
Hi guys, We appreciate your help as we are stuck in middle of nowhere. Usually all things we find on this more than usefull forum, but right now - we read for last 2 weeks, our budget for project are going up - we breaking a costs and have finished very large project until very end and STUCK...yes stuck because of some errors which can find it out :( We are so depressed, we doing every day until 5am - stripping code trying to find solutions but no way and there is nothing on internet about this errors. Firstly we have 2 classes - 1 arrays of vehicles with parametears (bhp, weight...) and 2nd playerInfo class. We have standard Binnary formater - with whom we have problem already of missing / before file name - but right now as we implement Mono.Reflect on iOS and use preowned parameters scene works ok on mobile. But if I create class of cars JIT and save it and back from show room to garage...guess what it bringing me for 2 weeks same errors - he freeze iphone5 device (up to then runs smoothly) and Xcode bring me bunch of treads and this is always standard - also Android log give me all the time Null reference exceptions as something which I get it from car-script are not right - or array passing maximum no. I'm not sure - what is about - we have XML for multilanguage -but its works - we have tested and confirmed that loading - saving scene working (or maybe part of it) here is vehicle class we have for every car( when I preset it it works fine): using UnityEngine; using System.Collections; using System.Collections.Generic; [System.Serializable] public class Vehicles { private int carModel; private int tier; private float bhp; private float weight; private float grip; private float gearbox; private float brakes; private float steering; private int stageBrakes; private int stageEngine; private int stageGearBox; private int stageSteering; private int stageNOS; private int stageTurbo; private int stageTyre; private int stageBody; private float rating; public Vehicles (int carModel, int tier, float bhp, float weight, float grip, float gearbox, float brakes, float steering) { Bhp=bhp; Weight=weight; Grip=grip; Gearbox=gearbox; Brakes=brakes; Steering=steering; CarModel=carModel; Tier = tier; //postaviti sve levele na 1 pri kupovini kola stageBrakes=1; stageEngine=1; stageGearBox=1; stageSteering=1; stageNOS=1; stageTurbo=1; stageTyre=1; stageBody=1; rating=0; } public int Tier { get { return tier; } set { tier = value; } } public float Rating //rating sistem { get { rating = bhp/5+steering/70+brakes/80+weight/33+gearbox/40; return rating; } set { rating = value; } } public float Gearbox { get { return gearbox; } set { gearbox = value; } } public int StageBody { get { return stageBody; } set { stageBody = value; } } public int StageTyre { get { return stageTyre; } set { stageTyre = value; } } public int StageTurbo { get { return stageTurbo; } set { stageTurbo = value; } } public int StageNOS { get { return stageNOS; } set { stageNOS = value; } } public int StageSteering { get { return stageSteering; } set { stageSteering = value; } } public int StageGearBox { get { return stageGearBox; } set { stageGearBox = value; } } public int StageEngine { get { return stageEngine; } set { stageEngine = value; } } public int StageBrakes { get { return stageBrakes; } set { stageBrakes = value; } } public int CarModel { get { return carModel; } set { carModel = value; } } public float Bhp { get { return bhp; } set { bhp = value; } } public float Weight { get { return weight; } set { weight = value; } } public float Grip { get { return grip; } set { grip = value; } } public float Brakes { get { return brakes; } set { brakes = value; } } public float Steering { get { return steering; } set { steering = value; } } } here is seconds part binnary formater we use for that: void SaveCarData() { var b = new BinaryFormatter(); var f = File.Create(Application.persistentDataPath + imeFajlaWTRData ); for (int i = 1; i <= brojMojihVozila; i++) b.Serialize(f, mojaVozila[i]); f.Close(); } void LoadSavedCarData() { //LOAD ako je vec otvarano if(File.Exists(Application.persistentDataPath + imeFajlaWTRData )) { var b = new BinaryFormatter(); var f = File.Open(Application.persistentDataPath + imeFajlaWTRData , FileMode.Open); **for (int i = 1; i <= brojMojihVozila; i++) mojaVozila[i] = (Vehicles) b.Deserialize(f);** f.Close(); } just to mention that I start usage of vehicles from 1 - so 1st array was never initialized - does it matter on mobile? (I realized that I do not test with that option setup). Guy, we really appreaciate if you find a time, I know you have job to do's but please if you have similar issue we will not spent weeks after anyhow hard work for this kind of stuff. All the best and thanks!

Viewing all articles
Browse latest Browse all 4709

Trending Articles