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 CognitiveVision · Jun 14, 2013 at 10:32 PM · arraysmonobehaviourlength

Can no longer get Array length?

I had a script that's been working fine, the only thing that's been different is I changed it to Monobehaviour. After I've done this I can no longer get the length of my arrays. I can still access the arrays as if they are, but I cant get their length anymore. The Array.length option doesn't even show up in the tips while typing. And if I type it anyway I'll get "unresolved member" error when I scroll over it. And in Unity I get: Assets/Scripts/Player/AttackClass.cs(79,46): error CS1061: Type ComboFrames[]' does not contain a definition for length' and no extension method length' of type ComboFrames[]' could be found (are you missing a using directive or an assembly reference?)

 public class AttackClass : MonoBehaviour
 {
     public ComboFrames[] GroundCombo;
     public ComboFrames[] AirCombo;
 
     //Ints that hold the max number of combos for the attacks.
     private int maxCombo;
     private int maxComboGround;

     public int[] testing;
     void Awake()
     {
         Debug.Log(testing.Length);
         Debug.Log(GroundCombo[0].start);
         maxComboGround = GroundCombo.Length;
         Debug.Log(maxComboGround);
     }
 }
 
 [System.Serializable]
 public class ComboFrames
 {
     public int start;
     public int active;
     public int ending;
     /// <summary>
     /// Amount of frames allowed for input into next combo.
     /// </summary>
     public int combo;
 }

The GroundCombo[0].start works just fine, so its an Array and it exists... However 'length' or any other array extensions just aren't there. The 'testing' integer array works fine with the extensions. Do class arrays not work with array extensions when you're using Monobehaviour? Are there any work arounds?

Update: Stopped having a problem and was working fine, then it suddenly stopped working again. What I noticed is when I scroll over a declaration of GroundCombo and the tooltip comes up. It doesn't show ComboFrames[] like it would with testing showing int[], it just shows up ComboFrames as if it isn't even an array, just a single instance. Seems like this is more of an issue with MonoDev than Unity. This question can be closed.

Comment
Add comment · Show 1
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 bubzy · Jun 15, 2013 at 05:55 AM 0
Share

sometimes, while you are coding and you start a curly brace, lets say

 if (val < targetVal)
 {

monodevelop will get really fussy about the curly brace not being closed. it is, therefore good practice to close it BEFORE you write any code inside the curly braces

 if (val < targetVal)
 {
 }
 
 
 //now you can write code
 
 if (val < targetVal)
 {
 //do something awesome
 }
 

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by bubzy · Jun 14, 2013 at 10:37 PM

its

 Length

 

not

 length

:)

Comment
Add comment · Show 1 · 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

15 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

Related Questions

Gun Class with Array List of Projectiles 2 Answers

Why Again Arrays In ExecuteInEditMode() Gives NullReferenceException Errors?? 1 Answer

Classes : extend MonoBehaviour issues 1 Answer

Material Array list and its .length not working/showing in dropdown menu 1 Answer

Is for loop caching worth it in unity3d Mono Develop 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