Hi! It is showing me this error. Assets\PlayerController.cs(22,38): error CS1061: 'Collider2D[]' does not contain a definition for 'length' and no accessible extension method 'length' accepting a first argument of type 'Collider2D[]' could be found (are you missing a using directive or an assembly reference?) I was watching a YouTube Video on 2D Stickman Ragdoll, She created a for loop but for me no matter what, the for loop is not creating. Here is the link of the video If you want my the code I have written just please reply to this thread and I will give it to you. My main problem is that it's not adding for loop.
Note that this has nothing to do with Code Editors & IDEs so you shouldn't really be posting here. This is more appropriate to the scripting forum. I think it's simply a typo though. If you're following a tutorial and you've typed stuff wrong then go back to the tutorial and look at it again carefull comparing it to what you've typed. In your case, all you have to do is look at something specific. Also, if you're going to refer to a tutorial then in the very least, please put in a time-stamp otherwise you're expecting people trying to help you to watch the whole video to find what you might mean. So yes, there's no "length" method for C# array type. C# is case-sensitive and you have to be 100% accurate. There is a "Length" property which you can clearly see in the tutorial at 7:30 https://docs.microsoft.com/en-us/dotnet/api/system.array.length?view=net-6.0#system-array-length This is the same as there not being a type named "collider2d", "coLLider2D" or "CoLliDeR2d". Case matters in C#.
Um..Hey! I am really sorry but can you please tell me that where have I uploaded this? And It's not about 7:30, I will just ask in Scripting forum but thanks for your help, MelvMay
I'm not following what you're asking here. As I said, at 7:30 the person in the tutorial shows you using the "Length" property correctly, take a look. You are using (lowercase) "length". You have to use the correct case as C# is case-sensitive.
See here: Note it's uppercase "L". Your error shows you're using lowercase "l". It has to be exact. I am not sure how much clearer I can be here.
Hey! Thanks, I understand what you mean. Give me a few days and hopefully I come back with a working script