[Solved]C# Help with Gizmos

Started by kwang4, July 16, 2020, 12:25:15 PM

Previous topic - Next topic

kwang4

Currently modifying QEE to add a small gizmo to clone vat so I can choose what age the clone should be. So far I have

yield return new Command_Action()
            {
                defaultLabel = "Age: " + (old ? "18" : "10"),
                defaultDesc = "Age of Vatgrown",
                icon = ContentFinder<Texture2D>.Get("Things/Item/Health/HealthItem", true),
                order = -100,
                action = () =>
                {
                    Find.WindowStack.Add(new FloatMenu(new List<FloatMenuOption>()
                    {
                        new FloatMenuOption("18",()=>{minAge = pawnKindToGrow.RaceProps.lifeStageAges.Last().minAge;old = true;}),
                        new FloatMenuOption("10",()=>{minAge = 10f; old = false;})
                    }));
                }
            };

old is a boolean defined outside to change the age text.

In game switching from 18 to 10 works, but when I click the 18 option it gives me this error:

https://imgur.com/a/UmzggOs

Messed around with the code for a bit, seems that the boolean isn't the problem, it's just the first float menu option. Stumped on how to fix it though.

Any help appreciated!

kwang4

I would like to state that I am an idiot. The code for gizmos was correct but the part for minAge in the 18 option was referencing an null object. Leaving this here in case anyone wants working code for making building gizmos.