我有 WallCreator 脚本来在 Unity 中放置墙,另一个是 WallCreatorSwitcher 通过检查切换来打开/关闭 WallCreator。我也想通过使用更改Wallprefab的图层GetComponent<WallCreator>().wallPrefab.layer = LayerMask.NameToLayer("LayerName");,因此当检查切换时(WallCreator On)图层是“忽略射频” - 它可以工作,并且如果未选中切换(WallCreator Off)图层是“默认” - 但是问题是,在这种情况下它不会改变图层。
public class WallCreatorSwitcher : MonoBehaviour {
public Toggle toggle;
public Text text;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (toggle.isOn)
{
GetComponent<WallCreator>().enabled = true;
Debug.Log("Wall Creator is ON");
text.enabled = true;
GetComponent<WallCreator>().wallPrefab.layer = LayerMask.NameToLayer("Ignore Raycast");
}
else
{
GetComponent<WallCreator>().enabled = false;
Debug.Log("Wall Creator is OFF");
text.enabled = …Run Code Online (Sandbox Code Playgroud) 如何编写输入类型="文本"的模式(它不能是数字,验证不能用JS),只允许我输入数字,最小值:1和最大值:5000?
<input type="text" name="someName" id="someId" required pattern=""/>Run Code Online (Sandbox Code Playgroud)
我有一些物品,一个叫做"父母",一个叫做"儿童"(图中第一个).如何在运行时将"Child"对象作为"Parent"对象的实际子对象(图片中的Nr.2)?
