在Unity中加载级别无法正常工作

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

我是游戏设计的新手,我正在使用团结。我用了以下代码 -

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

public class player_collisions : MonoBehaviour
{

private void OnCollisionEnter(Collision col)

{
    if(col.gameObject.tag == "Enemy")
    { PlayerDies(); }
}
void OnTriggerEnter(Collider trig)
{
    if (trig.gameObject.tag == "Coin")
    {
        //increase coin collection
        //increase audio
        Data_Management.dataManagement.coinsCollected++;
        Destroy(trig.gameObject);
    }

}

void PlayerDies()
{           SceneManager.LoadScene("main");
}

}

但是,当我的主场景被加载时,它看起来不同......请帮助!

actual scene after loadscene``

c# unity3d
1个回答
0
投票

This is a known behavior for the unity editor

确保它在正常构建时看起来没问题,而不是在编辑器中播放时。如果它看起来不错,您可以按照我链接的说明进行修复。

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