Hi everyone,
I have to create an array that i can use in in several functions, but if i want to create it I get an error
public class PosChanged : MonoBehaviour {
private int changeCount = 0;
private int breakForce = 20;
Vector3[] v = new Vector3[transform.childCount];
Vector3[] v_old = new Vector3[transform.childCount];
.....
I know I would have to do it in Start() because of the transform.childCount, but I cant access it then in FixedUpdate() if its created in Start().
So how do I do that?
Errormsg:
(8,35): error CS0236: A field initializer cannot reference the nonstatic field, method, or property `UnityEngine.Component.transform’