Unity 2d:有效的游戏对象集对父母和所有孩子均无效

问题描述 投票:0回答:1

我为2d游戏统一制作了两个脚本。一个将布尔值设为true,这是另一个的代码:

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameManagerScript : MonoBehaviour
{
    public float weapons;
    public float money;
    public bool tutorial = true;
    public bool tutorialcoins = false;
    public bool tutorialsword = false;
    public bool tutorialenemies = false;
    // Start is called before the first frame update
    void Start()
    {
        if (tutorial)
        {

    if (!tutorialcoins)
        {
            GameObject.Find("Coins").SetActive(false);
        }
        }

}

// Update is called once per frame
void Update()
{
    if (tutorialcoins)
    {
        GameObject.Find("Coins").SetActive(true);
    }

 }

所以我使用了该代码和名为Coins的对象,它有很多子代。当我将tutorialcoins设置为true时,子代或代币都不会激活,什么也不会发生!请知道我做错了什么吗?>

我为2d游戏统一制作了两个脚本。一个将布尔值设置为另一个布尔值,这是另一个的代码:using System;使用System.Collections;使用System.Collections.Generic;使用...

c# unity3d
1个回答
0
投票

尝试一下

© www.soinside.com 2019 - 2024. All rights reserved.