Hello, I would like to automatically store 30 points in the array. I’ve tried writing a script, but it doesn’t work. Could you please suggest how to make it work properly?
Thank you!
using UnityEngine;
using System.Collections;
public class randompoint: MonoBehaviour {
public Transform target1;
public Transform target2;
public Transform target3;
public Transform target4;
public Transform target5;
public Transform target6;
public Transform target7;
public Transform target8;
public Transform target9;
public Transform target10;
public Transform target11;
public Transform target12;
public Transform target13;
public Transform target14;
public Transform target15;
public Transform target16;
public Transform target17;
public Transform target18;
public Transform target19;
public Transform target20;
public Transform target21;
public Transform target22;
public Transform target23;
public Transform target24;
public Transform target25;
public Transform target26;
public Transform target27;
public Transform target28;
public Transform target29;
public Transform target30;
//create array from points
public Transform[] allpoints;
// Use this for initialization
void Start () {
allpoints = new Transform[30];
for(int i = 0; i < 30; i++){
allpoints *= "target" + i.ToString();*
_ Debug.Log(allpoints*);_
_ }*_
* }*
}