Open BlazeYTTT opened 2 months ago
Hi, it looks to me like your GetAssets
method might be the problem. I think it is not correctly retrieving your model prefab. For that reason, I think vehicle.model
is null when Register
is invoked
Submersible nowcub = vehicle.model.EnsureComponent<vehicle>() as Submersible;
causing the error in the log:
NullReferenceException: Object reference not set to an instance of an object Stack trace: Radical.EnsureComponent
I think the fix should be in here:
System.Object[] arr = myLoadedAssetBundle.LoadAllAssets();
foreach (System.Object obj in arr)
{
if (obj.ToString().Contains("MY_SPRITE_ATLAS_NAME"))
{
model = (GameObject)obj;
}
}
Perhaps like this:
System.Object[] arr = myLoadedAssetBundle.LoadAllAssets();
foreach (System.Object obj in arr)
{
if (obj.ToString().Contains("MY_CORRECTED_PREFAB_NAME"))
{
VehicleFramework.Logger.Log("Found the prefab!");
model = (GameObject)obj;
}
}
Thank You! But i have another error (0-0)
[Error :VehicleFramework] vehicle: A null VehicleBattery.BatterySlot was provided. There would be no way to access this battery.
[Error :VehicleFramework] Invalid Submersible Registration for the vehicle. Next.
But the battery slots are correctly setted up (probably) Class with battaries
public override List<VehicleBattery> Batteries
{
get
{
var list = new List<VehicleFramework.VehicleParts.VehicleBattery>();
VehicleFramework.VehicleParts.VehicleBattery v61 = new VehicleFramework.VehicleParts.VehicleBattery();
v61.BatterySlot = transform.Find("Battaries/Battary1").gameObject;
list.Add(v61);
VehicleFramework.VehicleParts.VehicleBattery v62 = new VehicleFramework.VehicleParts.VehicleBattery();
v61.BatterySlot = transform.Find("Battaries/Battary2").gameObject;
list.Add(v62);
return list;
}
}
Unity gameobject Screenshot:
Pls help me, im really don
t know what happend.
Hi, it looks like a simple fix. Sorry for the delayed reply. You sent this:
public override List<VehicleBattery> Batteries
{
get
{
var list = new List<VehicleFramework.VehicleParts.VehicleBattery>();
VehicleFramework.VehicleParts.VehicleBattery v61 = new VehicleFramework.VehicleParts.VehicleBattery();
v61.BatterySlot = transform.Find("Battaries/Battary1").gameObject;
list.Add(v61);
VehicleFramework.VehicleParts.VehicleBattery v62 = new VehicleFramework.VehicleParts.VehicleBattery();
v61.BatterySlot = transform.Find("Battaries/Battary2").gameObject; // error is here!
list.Add(v62);
return list;
}
}
So I think you should change this to reference the right VehicleBattery (v62 instead of v61).
v61.BatterySlot = transform.Find("Battaries/Battary2").gameObject;
Make it look like this instead:
v62.BatterySlot = transform.Find("Battaries/Battary2").gameObject;
That's an easy mistake to make, and I've made it many times :-)
Thank you (when i be in home i try this.)
Hey! Can you help me with my error?
I tried to create vehicle on vehicleFramework, but after my hourly work i see this error in BeplnEx log
I think problem with MainPatcher.cs, but i can't find it :/
My MainPatcher.cs
My vehicle.cs
My PluginInfo.cs
My unity project:
P.S Sorry for my eng