Question by
rainbow_design · Sep 15, 2015 at 12:56 PM ·
unity 5gameobjectbuttononclickpython
Button object has no attribute OnClick
I copied and formed this from an example and i really scratch my head whats wrong with it.
From
kgo = GameObject()
butn = kgo.AddComponent[Button]()
butn.OnClick.AddListener(dicbrowser)
i get: 'Button' object has no attribute 'OnClick'
I get the same problem when i Instantiate a Button. Whats wrong with this? Oh and before you wonder why so much of text and ; are missing this is python but i guess its easy enough to read when you know c#
Comment
Best Answer
Answer by rainbow_design · Sep 15, 2015 at 01:28 PM
Aww i found my mistake
butn.OnClick
must be
butn.onClick