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
0
Question by Essential · Feb 03, 2014 at 07:21 PM · javascriptarraysreverse

What the heck is a 'function(System.Array): void' Type?

I posted this a couple of months ago: I can't see a reason for this Array.Reverse() error. In brief, trying to Reverse a color array in UnityScript returned an IENumerable and I needed to convert it to an array to use it as one…

var test2 = test.Reverse().ToArray();

This was working fine but after updating to the latest version of Unity and MonoDevelop, it's now broken and I'm getting some weird errors…

First error: BCE0023: No appropriate version of 'System.Array.Reverse' for the argument list '()' was found. — Solved by removing the brackets on the end of Reverse but…

var test2 = test.Reverse.ToArray();

Second error: BCE0019: 'ToArray' is not a member of 'function(System.Array): void'. — Maybe it's converted to an Array directly in the new MonoDevelop and I don't need to convert? So I remove the ToArray() section…

var test2 = test.Reverse;

Third error: BCE0048: Type 'function(System.Array): void' does not support slicing. — So I can't access it as an array…

It seems they've changed some underlying code structure in MonoDevelop. Any ideas on a fix?

Comment
Add comment · Show 2
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 Kiloblargh · Feb 03, 2014 at 07:30 PM 0
Share

I don't know if this is a stupid question, but did you try it using LINQ?

avatar image Essential · Feb 03, 2014 at 07:44 PM 0
Share

Ooh, not a stupid question — I didn't think of that actually. LINQ does appear to work fine.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by ArkaneX · Feb 03, 2014 at 07:42 PM

Agree with Kiloblargh comment - Reverse (without parameters) is a LINQ extension method, and you problably don't have

 using System.Linq;

in your code.

I guess that without this 'using', Unity compiler thinks you want to use Reverse method of System.Array class. This is a static void method, accepting System.Array parameter, and hence the compiler errors you see.

Comment
Add comment · Show 2 · 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 Essential · Feb 03, 2014 at 07:46 PM 0
Share

Yep, Linq does fix the issue. Although I don't understand why it worked previously and suddenly broke.

avatar image ArkaneX · Feb 03, 2014 at 08:00 PM 0
Share

Hmm I've just checked the tags in your question and see that you use javascript. I generally use C#, but from time to time I do some test using JS as well. I once observed, that adding import System.Linq; to any of your JS scripts works for all scripts in the project. $$anonymous$$aybe this worked in one of previous Unity versions, and now has been changed? Or maybe you simply removed the script containing this line?

avatar image
0

Answer by 9h057 · Feb 03, 2014 at 07:59 PM

Try add

 using System.Linq;
Comment
Add comment · 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

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

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Javascript / Unityscript adding elements of an array 2 Answers

Referencing data in pre-defined array 1 Answer

JavaScript 3 Arrays questions 1 Answer

Why can't I push and pop from string array? 1 Answer

Is IsNan not IsInfinity ?? 4 Answers


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