Answer the question
In order to leave comments, you need to log in
How to add method to public class from another script?
Task: add a method to the public class Game
public void VehicleMaxFuel(float value)
{
bool flag = this._vehicle != null;
if (flag)
{
this._vehicle.maxFuel = value;
}
}
private Game.VehicleData _vehicle = null;
Answer the question
In order to leave comments, you need to log in
Hey!
It is not clearly written what is where and why.
If I understand correctly, you need to use the VehicleMaxFuel() method .
Option 1: Create an instance of the class containing the method and that's it.
Game testclass = new Game();
testclas.VehicleMaxFuel()
public class MyClass : ModClass
{
public void VehicleMaxFuel(float value) {....}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question