GameObject W=enemyGrop. Transform. GetChild (I). The GameObject.
Can't use w.g etComponent<script name & gt; (a); Because don't know is that the script name, please give advice or comments!
CodePudding user response:
Not normal, this is mount script component is an object, since it is object is a known object can obtain,Actually don't recommend that you do so, if you really want to collective control, then you should let them inherit a public parent class, everyone can do the same action,
If is to script node, then suggested to hang multiple scripts, with/without switching method to make some changes,
CodePudding user response:
Thank you upstairs! Your method is in place!!!!!CodePudding user response:
Try a variety of methods to traverse enumeration is not successful, the following code is online, also make a mistake, could you tell me how to traverse the enumeration everyone?Using UnityEngine;
Using System. The Collections;
using System.Collections.Generic;
Using UnityEngine;
using System;
Public enum famaily {xuhaitao xuhaihuan, xuhairu};
Public class ff: MonoBehaviour {
Void the Start () {
Foreach (famaily step in Enum. GetValues (typeof (famaily)))
{
Print (step);
}
}
}