using System.Collections;using System.Collections.Generic;using UnityEngine;publicclassNewBehaviourScript:MonoBehaviour{
public GameObject[] myObjects;
目录一、问题二、思路二、实现三、总结一、问题如果场景中有多个物体的时候,希望通过一个脚本就能够控制所有物体。上两张聊天请教截图:二、思路设置一个变量,将脚本设计为一个接口。点击物体改变变量的值,根据变量不同的值进行不同的操作。二、实现往场景中拖放三个Cube新建脚本Control.cs脚本代码:using System.Collections;using System.Collections.Generic;using UnityEngine;public class