Author Topic: on click function,function with arguments problem  (Read 3319 times)

nitzamc

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 7
    • View Profile
on click function,function with arguments problem
« on: November 02, 2014, 11:14:33 AM »
i have this code :

  1. public void changescene(string sceneName)
  2. {
  3.  //blablabla
  4. }
  5.  

and i reference it on Button OnClick and the argument comes as Object :/ not a string

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: on click function,function with arguments problem
« Reply #1 on: November 03, 2014, 06:36:35 AM »
Well what did you choose for the parameter? You need to specify a property that returns a string.

nitzamc

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: on click function,function with arguments problem
« Reply #2 on: November 08, 2014, 06:35:10 AM »
it only takes object as argument

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: on click function,function with arguments problem
« Reply #3 on: November 09, 2014, 09:01:52 PM »
No...  it can take a string, but you need to specify a property there. You can't specify a value. For example, you can use the Component.name as the property.

Alternative is to get rid of your (string sceneName) altogether. What's the point of it there?