- Home /
Bad array declaration: Why won't this compile?
public void CleanJointConnections()
{
FixedJoint temp[] = gameObject.GetComponents<FixedJoint>();
foreach (FixedJoint joint in temp2)
{
Destroy(joint);
}
}
Error message is: Assets/Ultimate Game Tools/Fracturing/Scripts/FracturedChunk.cs(706,20): error CS0650: Syntax error, bad array declarator. To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type
I have no idea what a rank specifier is. I just want to grab a list of all the fixedJoints on this object and then delete them.
make it work for me please? <3
Answer by vexe · Feb 06, 2015 at 02:48 PM
Type Name[] = ...
is C++
Type[] Name = ...
is C#
The error is telling you that the brackets [] come before the name, not after.
that's what i was looking for. I knew it must have been something simple
Answer by GameVortex · Feb 06, 2015 at 02:48 PM
Did you try searching the error at all? First result for "c# error CS0650": https://msdn.microsoft.com/en-us/library/697yab2a.aspx
Your answer
![](https://koobas.hobune.stream/wayback/20220613182637im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Find all GameObjects with tag and add them to a transform array 2 Answers
GetComponents array in C# error ? 4 Answers
How to make an Array equal the Components of an Instantiated GameObject 1 Answer
Does GetComponents() return the components in the order that they are displayed in the editor? 1 Answer
I dont know why im getting a null reference exception 1 Answer