C# Unity代码在编辑器中工作,但在构建C上不工作#

C# Unity代码在编辑器中工作,但在构建C上不工作#,c#,unity3d,C#,Unity3d,首先,我知道还有其他人也有同样的问题,不,他们的解决方案对我没有帮助 我正在为大学做最后一个项目,他们强迫我们使用Perforce Helix客户端(顺便说一句,这纯粹是地狱)进行版本控制 我和我的小组日夜在编辑部处理问题。然后我们终于到了可以测试构建的部分。我们这边的建筑很好。(是的,我们在perforce中删除了旧的生成文件,并获得了当前的生成文件) 然后,灾难发生了,当我们的教授测试我们的游戏时,我们的动作脚本不起作用,他给了我们另一个机会,但他说我们的分数不能高于70分 无论如何,我不是

首先,我知道还有其他人也有同样的问题,不,他们的解决方案对我没有帮助

我正在为大学做最后一个项目,他们强迫我们使用Perforce Helix客户端(顺便说一句,这纯粹是地狱)进行版本控制

我和我的小组日夜在编辑部处理问题。然后我们终于到了可以测试构建的部分。我们这边的建筑很好。(是的,我们在perforce中删除了旧的生成文件,并获得了当前的生成文件)

然后,灾难发生了,当我们的教授测试我们的游戏时,我们的动作脚本不起作用,他给了我们另一个机会,但他说我们的分数不能高于70分

无论如何,我不是制作这个脚本的人,但我想知道这里是否有任何东西会导致脚本在构建中无法工作

对于那些不在乎背后故事的人-

问题:玩家不会在我们的构建和控制台垃圾信息中移动

预期:角色四处移动

我们尝试的内容:删除过去的版本,重新下载当前版本,并检查inspector中的所有内容

动作脚本:

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

public class PlayerMovement : MonoBehaviour
{
    public float moveSpeed;
    private Rigidbody rb;

    private Vector3 moveInput;
    private Vector3 moveVelocity;
    private Vector3 mousePosition;
    

    private Camera mainCamera;

    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent<Rigidbody>();
        mainCamera = FindObjectOfType<Camera>();
    }

    // Update is called once per frame
    void Update()
    {
   
        float distance = Vector3.Distance(transform.position, mousePosition);
        if(distance > 2)
        {
            moveInput = new Vector3(Input.GetAxisRaw("Horizontal") * 40 * Time.smoothDeltaTime, 0f, Input.GetAxisRaw("Vertical") * 40 * Time.smoothDeltaTime);
            moveVelocity = moveInput * moveSpeed * Time.smoothDeltaTime;
        }
        

        mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);


        RaycastHit hit;
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit, 2000))
        {
            transform.LookAt(new Vector3(hit.point.x, transform.position.y, hit.point.z));
        }




    }

   void FixedUpdate()
    {
        rb.velocity = moveVelocity;
    }


}
使用系统集合;
使用System.Collections.Generic;
使用UnityEngine;
公共类玩家运动:单一行为
{
公共交通速度;
私人刚体;
专用矢量输入;
私有向量3移动速度;
专用矢量3鼠标定位;
私人摄像机;
//在第一帧更新之前调用Start
void Start()
{
rb=GetComponent();
mainCamera=FindObjectOfType();
}
//每帧调用一次更新
无效更新()
{
浮动距离=矢量3.距离(transform.position、mousePosition);
如果(距离>2)
{
moveInput=新矢量3(Input.GetAxisRaw(“水平”)*40*Time.smoothDeltaTime,0f,Input.GetAxisRaw(“垂直”)*40*Time.smoothDeltaTime);
moveVelocity=moveInput*moveSpeed*Time.smoothDeltaTime;
}
mousePosition=Camera.main.ScreenToWorldPoint(Input.mousePosition);
雷卡斯特击中;
Ray-Ray=Camera.main.screenpointoray(输入.鼠标位置);
如果(物理学.光线投射(光线,出击,2000))
{
看(新向量3(hit.point.x,transform.position.y,hit.point.z));
}
}
void FixedUpdate()
{
rb.速度=移动速度;
}
}
记分员:

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

public class PointsKeeper : MonoBehaviour
{
    public int points = 0;
    public Text pointText;
    public GameObject toExpensiveText;
    public float expensiveTimer = 1.0f;

    public GameObject healthPage;
    public GameObject weaponPage;
    public GameObject modPage;

    public GameObject lifeBlocker;
    public GameObject lifeSector;
    public GameObject lifeDropChanceSector;

    public GameObject shieldBlocker;
    public GameObject shieldRegensector;

    public GameObject healthBlocker;
    public GameObject healthcapacitysector;

    private PlayerHealth playerHealth;

    public Sprite fullCell;
    public Sprite emptyCell;

    //Health Page
    private int healprice = 100;
    public Text healpriceText;
    public GameObject healButton;

    public int maxHealthLVL = 0; 
    private int maxHealthMAXLVL = 5; 
    private int maxHealthprice = 100;
    public Text maxhealthpricetext;
    public GameObject maxhealthButton;
    public Image[] maxhealthCells;


    public int healDropChanceLVL = 0;
    private int healdropchanceprice = 100;
  

    public int shieldcapacityLVL = 0;
    private int sheildcapacityPrice = 100;

    public int shieldRegenRateLVL = 0;

    public int lifeDropChanceLVL = 0;

    public int lifeCapacityLVL = 0;

    private int lifePrice;


 

    //Weapon Page

    //Mod Page

    // Start is called before the first frame update
    void Start()
    {
        points = 0;
        playerHealth = FindObjectOfType<PlayerHealth>();
        toExpensiveText.SetActive(false);
    }

    // Update is called once per frame
    void Update()
    {
        
        pointText.text = points.ToString();
        healpriceText.text = healprice.ToString();
        maxhealthpricetext.text = maxHealthprice.ToString();

        maxHealthCellControl();
        

        if (lifeCapacityLVL >= 1)
        {
            lifeBlocker.SetActive(false);
            lifeSector.SetActive(true);
            lifeDropChanceSector.SetActive(true);
        }
        
        if (shieldcapacityLVL >= 1)
        {
            shieldBlocker.SetActive(false);
            shieldRegensector.SetActive(true);
        }
       
        if (playerHealth.playerHP == playerHealth.maxheart)
        {
            healthBlocker.SetActive(false);
            healthcapacitysector.SetActive(true);
        }
        else
        {
            healthBlocker.SetActive(true);
            healthcapacitysector.SetActive(false);
        }
        
        if(playerHealth.playerHP == playerHealth.maxheart)
        {
            healButton.SetActive(false);
        }
        else
        {
            healButton.SetActive(true);
        }


        if (Input.GetKeyDown(KeyCode.P))
        {
            points = points + 100000;
        }
    }
    public void pointsGained(int pointsup)
    {
        points = points + pointsup;
    }

    public void healthPageOn()
    {
        healthPage.SetActive(true);
        modPage.SetActive(false);
        weaponPage.SetActive(false);
    }
    public void weaponPageOn()
    {
        healthPage.SetActive(false);
        modPage.SetActive(false);
        weaponPage.SetActive(true);
    }
    public void modPageOn()
    {
        healthPage.SetActive(false);
        modPage.SetActive(true);
        weaponPage.SetActive(false);
    }


    public void toExpensive()
    {

    }

    public void buyHeal()
    {
        if(points >= healprice)
        {
            points = points - healprice;
            healprice = healprice + 100;
            playerHealth.playerHP = playerHealth.playerHP + 1;
        }
        else
        {
            toExpensive();
        }
    }

    public void buyMaxHealth()
    {
        if (points >= maxHealthprice && maxHealthLVL < 5)
        {
            maxHealthLVL = maxHealthLVL + 1;
            points = points - maxHealthprice;
            playerHealth.maxheart = playerHealth.maxheart + 1;
        }
        else
        {
            toExpensive();
        }


        if (maxHealthLVL == 1)
        {
            maxHealthprice = 1000;
        }
        else if (maxHealthLVL == 2)
        {
            maxHealthprice = 2000;
        }
        else if (maxHealthLVL == 3)
        {
            maxHealthprice = 4000;
        } 
        else if (maxHealthLVL == 4)
        {
            maxHealthprice = 10000;
        } 
        else if (maxHealthLVL == 5)
        {
            maxhealthButton.SetActive(false);
            maxhealthpricetext.gameObject.SetActive(false);
        }
    }

    public void maxHealthCellControl()
    {
       
        for (int i = 0; i < maxhealthCells.Length; i++)
        {
            if (i < maxHealthLVL)
            {
                maxhealthCells[i].sprite = fullCell;
            }
            else
            {
                maxhealthCells[i].sprite = emptyCell;
            }
            if (i < maxHealthMAXLVL)
            {
                maxhealthCells[i].enabled = true;
            }
            else
            {
                maxhealthCells[i].enabled = false;
            }

        }

    }
}
使用系统集合;
使用System.Collections.Generic;
使用UnityEngine;
使用UnityEngine.UI;
公共类指针:单行为
{
公共积分=0;
公共文本点文本;
公共游戏对象到ExpensiveText;
公共浮动费用时间=1.0f;
公共游戏对象健康页面;
公开游戏对象武器页面;
公共游戏对象页面;
公共游戏对象救生柜;
公共游戏对象生命部门;
公共游戏对象lifeDropChanceSector;
公共游戏对象屏蔽器;
公共游戏对象屏蔽区;
公共游戏对象阻止程序;
公共游戏对象healthcapacitysector;
私人玩家健康玩家健康;
公共雪碧全细胞;
公共雪碧空城;
//健康网页
私有整数healprice=100;
公共文本healpriceText;
公共游戏对象healButton;
public int maxHealthLVL=0;
私有int maxHealthMAXLVL=5;
私人int maxHealthprice=100;
公共文本;
公共游戏对象maxhealthButton;
公众形象和健康细胞;
公共int healDropChanceLVL=0;
私有整数healdropchanceprice=100;
公共int屏蔽容量ylvl=0;
私人int sheildcapacityPrice=100;
public int shieldrengratelvl=0;
公共int lifeDropChanceLVL=0;
公共int lifeCapacityLVL=0;
私人价格;
//武器页
//修改页
//在第一帧更新之前调用Start
void Start()
{
分值=0;
playerHealth=FindObjectOfType();
toExpensiveText.SetActive(false);
}
//每帧调用一次更新
无效更新()
{
pointText.text=points.ToString();
healpriceText.text=healprice.ToString();
maxhealthpricetext.text=maxHealthprice.ToString();
maxHealthCellControl();
如果(lifeCapacityLVL>=1)
{
LifeLocker.SetActive(假);
lifeSector.SetActive(真);
lifeDropChanceSector.SetActive(真);
}
if(屏蔽电容YLVL>=1)
{
屏蔽屏蔽器。设置激活(假);
shieldRegensector.SetActive(真);
}
if(playerHealth.playerHP==playerHealth.maxheart)
{
healthBlocker.SetActive(假);
healthcapacitysector.SetActive(真);
}
其他的
{
healthBlocker.SetActive(真);
healthcapacitysector.SetActive(假);
}
if(playerHealth.playerHP==playerHealth.maxheart)
{
healButton.SetActive(假);
}
其他的
{
healButton.SetActive(真);
}
if(Input.GetKeyDown(KeyCode.P))
{
点数=点数+100000;
}
}
公共无效点已启用(int pointsup)
{
点数=点数+点数上限;
}
公共健康网页()
{
healthPage.SetActive(true);
modPage.SetActive(false);
weaponPage.SetActive(假);
}
公共武器网页()
{
healthPage.SetActive(false);
modPage.SetActive(false);
weaponPage.SetActive(true);
}
公共无效modPageOn()
{
healthPage.SetActive(false);
modPage.SetActive(true);
weaponPage.SetActive(假);
public void maxHealthCellControl()
    {
       if (maxhealthCells == null) return;
        for (int i = 0; i < maxhealthCells.Length; i++)
        {
            if (i < maxHealthLVL)
            {
                maxhealthCells[i].sprite = fullCell;
            }
            else
            {