GUI.button

GUI.Button(Rect(BookXPos,10,100,100),BookTexture);
GUI.Button.AddComponent(SummonBtnJS);
GUI.Button.SummonBtnJS.SommunUnit = BookCurrent;
GUI.Button.SummonBtnJS.PageNumbe;

this is my attempt at add a script to a button and then assinging date to that script it didnt work and i get a nice long error

MissingMethodException: Method not found: ‘CompilerGenerated.DisplayTextJS_PlayerTwoView$callable0$91_13.AddComponent’.
Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.ProduceExtensionDispatcher ()
Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.Create ()
Boo.Lang.Runtime.RuntimeServices.DoCreateMethodDispatcher (System.Object target, System.Type targetType, System.String name, System.Object args)
Boo.Lang.Runtime.RuntimeServices.CreateMethodDispatcher (System.Object target, System.String name, System.Object args)
Boo.Lang.Runtime.RuntimeServices+c__AnonStorey12.<>m__6 ()
Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object args)
UnityScript.Lang.UnityRuntimeServices.Invoke (System.Object target, System.String name, System.Object args, System.Type scriptBaseType)
DisplayTextJS.PlayerTwoView () (at Assets/Scriptes/DisplayTextJS.js:91)
DisplayTextJS.OnGUI () (at Assets/Scriptes/DisplayTextJS.js:71)

Ideas?

That’s really not how GUI.Button works at all. Please see the docs for GUI.Button, which has script examples of usage. You also probably want to read the GUI scripting guide, which explains how to code GUI functionality in general. Short answer is, GUI.Button returns a boolean, so you can check if it was clicked or not, and if so, perform some action. It’s not something that you extend or add things to.

I have no idea what you want to do here. GUI.Button is a function it seems you tried using it like an object which of course doesn’t work…

I suggest you do some really basic programming tutorials.