(SOLVED) Gizmos error ... How to fix it ?

Started by soltysek, May 05, 2015, 03:27:29 AM

Previous topic - Next topic

soltysek

Hi .

I'm getting error on gizmo implementation and i cant find why becouse its almoust copy/past from other one .
Here is error :
System.MissingMethodException: Method not found: 'System.Environment.get_CurrentManagedThreadId'.
  at TLM.Building_SteamBoiler.GetGizmos () [0x00000] in <filename unknown>:0
  at RimWorld.InspectCommandGrid.DrawInspectCommandGridFor (IEnumerable`1 selectedObjects) [0x00000] in <filename unknown>:0


Here is gizmo itself :

public override IEnumerable<Gizmo> GetGizmos()
        {
            foreach (var g in base.GetGizmos())
            {
                yield return g;
            }
            if (this.StartBurn == false)
            {
                Command_Action act = new Command_Action();
                act.action = new Action(this.BurnStart);
                act.icon = LockCommandIcon;
                act.defaultLabel = "start";
                act.defaultDesc = "start";
                act.groupKey = 689739;
                yield return act;
            }
        }


Here call method :
private void Start()
        {
            this.StartBurn = true;
       }


Here var declare :

private static readonly Texture2D LockCommandIcon = ContentFinder<Texture2D>.Get("UI/Commands/Lock");
private bool StartBurn = false;



I try to IList<gizmo> i still have error in no method "BurnStart" not found in assembley
i try Lamda act.action = () => this.Start(); i'm geting reflection error folowed  by getType error

So my question is where i'm wrong and how right gizmo action call look like .

skullywag

What version of .net you running that looks like a .net version issue.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

soltysek

#2
.net 4.0 - i know its strange i try your gizmos that Works for you but i get error method not found , relly i try around 75 build most of them give method not found i ewven move method under gizmo for sure :)

skullywag

Try 4.5 thatll fix your issue. Your probably pointing to 4.5 in your project.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

soltysek

i will check that when i get home Again

Haplo

Is the new version of RimWorld/Unity .net 4.5 capable?
Last I know it needs to be set to .net 3.5?

soltysek

Im driving Home right now will try mess with .net version

soltysek

Ok i fix IT i was working on .net 4.5 i change it to 3.5 and some tweek in code and works fine

Here Are Fixed Code For other to use :
public override IEnumerable<Gizmo> GetGizmos()
        {
            IList<Gizmo> list = new List<Gizmo>();
            Command_Action command_Action = new Command_Action();
            if (StartBurn == false)
            {
                command_Action.icon = LockCommandIcon;
                command_Action.defaultDesc = "Frame On";
                command_Action.activateSound = SoundDef.Named("Click");
                command_Action.action = new Action(this.BurnStart);
                command_Action.groupKey = 887767541;
                list.Add(command_Action);
            }
            if (StartBurn == true)
            {
                command_Action.icon = LockCommandIcon;
                command_Action.defaultDesc = "Frame Off";
                command_Action.activateSound = SoundDef.Named("Click");
                command_Action.action = new Action(this.BurnStop);
                command_Action.groupKey = 887767542;
                list.Add(command_Action);
            }
           
            IEnumerable<Gizmo> commands = base.GetGizmos();
            return (commands == null) ? list.AsEnumerable<Gizmo>() : list.AsEnumerable<Gizmo>().Concat(commands);
        }


And action Methods :
public void BurnStart()
             {
            this.StartBurn = true;
             }
        private void BurnStop()
        {
            this.StartBurn = false;
        }


Thx To everyone for help

skullywag

yeah sorry i meant 3.5 for Rimworld, been using 4.5 on another project so its on the brain....
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Tynan

Tynan Sylvester - @TynanSylvester - Tynan's Blog