using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using VRTK;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class textCubedown : MonoBehaviour {
public GameObject byjNewPhot;
public void OnTriggerEnter(Collider other)
{
if (other.CompareTag("jumpscene"))
{
SceneManager.LoadScene("Scene1");
StartCoroutine(ByjNewPhot());
Debug.Log("我被碰撞了要重新加载scene1");
}
}
IEnumerator ByjNewPhot()
{
yield return new WaitForSeconds(1f);
byjNewPhot.SetActive(true);
}
}
同学你好,因为场景已经重新加载了,所以所有对象都被销毁了,代码也不会再执行了,可以做一个加载场景不销毁的游戏对象,存贮一个开关,当满足条件时,把图片加载出来就可以了