I'm trying to access a method in a protected class:
The trouble spot is with the pass by reference on
I get an error saying that it can't call a method that doesn't exist. When I try to call
I don't get any errors but core doesn't get set. I've tried several other permutations, and I can't quite figure it out.
Code Select
public static void GenerateShip(EnemyShipDef shipDef, Map map, TradeShip tradeShip, Faction fac, Lord lord, out Building core, bool clearArea = false, bool wreckEverything = false)
The trouble spot is with the pass by reference on
Code Select
out Building core
. When I try to call:Code Select
Traverse.Create(shipCombatManagerType).Method("GenerateShip").Value(...)
I get an error saying that it can't call a method that doesn't exist. When I try to call
Code Select
Building core = null;
ref Building coreRef = ref core;
Traverse.Create(shipCombatManagerType).Method("GenerateShip",
DefDatabase<EnemyShipDef>.AllDefs.Where(def=>def.spaceSite).RandomElement(),
map,
null,
Faction.OfAncients,
null,
coreRef,
true,
true).GetValue();
I don't get any errors but core doesn't get set. I've tried several other permutations, and I can't quite figure it out.