Rainbowdesign
Rainbowdesign

Reputation: 63

c# wants extra Argument when called from python (.net with ironpython)

I have this in c# (Gameobject is from unity3d)

namespace DLLTest
{
    public class buttong : MonoBehaviour
    {

        public GameObject BButtn([ParamDictionary] IDictionary kwargs)

This in the python init:

engine.Runtime.LoadAssembly(System.Reflection.Assembly.GetAssembly(typeof(DLLTest.buttong)));

And this in Python:

from DLLTest.buttong import BButtn
def BButton(**kwargs):
    BButtn(kwargs)

And i keep getting

TypeError: expected buttong, got dict

When i call it from c# it only wants the dictionary (i think), but from python it demands 2 Arguments a buttong type extra, i wonder why and how to supply a buttong type.

Upvotes: 2

Views: 267

Answers (1)

DorElias
DorElias

Reputation: 2313

you method BButtn is not static. so you need to call it with an instance of buttong (or make it static)

try doing

from DLLTest import buttong
def BButton(**kwargs):
    b= buttong()
    b.BButtn(kwargs)

Upvotes: 1

Related Questions