Assigning Vector3 Array values in C#

Yes, this has been debated a lot, yet I’m unable to find a stup similar to mine, nor any help in the Unity documentation, because it’s pretty outdated on the C# Array stuff. I have filed this to Unity. In the meantime, I’m STUCK, oh my GOD I hate it, any pointer would be very appreciated, thanks :slight_smile:

using UnityEngine;
using System.Collections;

public class Star_Handler : MonoBehaviour
{	
		public GameObject[] stars;
		public Vector3[] starMov;

		void Start ()
		{
				stars = GameObject.FindGameObjectsWithTag ("Star");
				for (int i = 0; i<stars.Length; i++) {
						starMov  *= new Vector3 (1.2f, 1.2f, 1.2f);//this line is giving me an Array out of range - why?*
  •  		}*
    
  •  }*
    

}

You aren’t initializing starMov to anything, so starMov_, where i is anything will return array out of bounds._
Try this:
stars = GameObject.FindGameObjectsWithTag(“Star”);
starMov = new Vector3[stars.Length];
for(int i = 0; i < stars.Length; ++i){
starMov = new Vector3(1.2f, 1.2f, 1.2f);
}
Edit: I was overzealous with my parens, fixed now.