Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Ecnalyr · May 31, 2010 at 07:26 AM · iphoneinvokeportexpression

Unity Iphone "It is not possible to invoke an expression of type 'Object'.

I'm trying to rewrite all my code without using dynamic typing as I just installed Unity Iphone and need all of my scripts to exist without dynamic typing.

I am having a rough time converting everything as I am quite the amature at scripting, currently I'm having a hard time with the following lines (they are from a timer script I found on the wiki/forums):


         if (f_timer_done) { 
            f_timer_done();
         }

I get the following error:

"It is not possible to invoke an expression of type 'Object'."

. . . and it points to the second line above (the one with f_timer_done();)

How do I resolve this error?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Mike 3 · May 31, 2010 at 07:44 AM

Since it's not using dynamic typing, it's confused as to what type the object is

Your best bet will be to assign a function to it at the start, so it knows what sort of delegate it needs (e.g. add a function called Blank which takes no parameters and does nothing, then do var f_timer_done = Blank; )

That should hopefully kick it into gear

Edit to make it a little clearer:

var f_timer_done = Blank; //this variable should already be in your code at the top

function Blank() { }

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Ecnalyr · May 31, 2010 at 07:54 AM 0
Share

When I literally make a function toward the top of the script that states:


function Blank()
{
var f_timer_done=Blank;
}

Nothing changes, the code still spits out the same error as above. What did I misunderstand here?

avatar image Ecnalyr · May 31, 2010 at 07:56 AM 0
Share

Or did you mean to put a "function Blank()" at the top of the script, and then do "var f_timer_done=Blank; after "if (f_timer_done){"

I ask because when I do that, the error goes away. I do not quite understand why though, nor do I know if the script will still function as I intend.

avatar image Mike 3 · May 31, 2010 at 07:58 AM 0
Share

no, not like that - there should already be an f_timer_done variable at the top - assign Blank to that

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

It is not possible to invoke an expression of type 'SpriteManager[]'. 1 Answer

Animation not playing when returning to a previous loaded scene 2 Answers

signal 11 (SIGSEGV), fault 2 Answers

Ani.Mate error when port a PC game to iPhone 2 Answers

What prevents an app from hitting a link that works in browser? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges