Hey! I am working on this game, where the player travels between rooms and I’ve come across a problem.
After re-enabling the sprites (for performance reasons) only the tree sprites appear.
The ground doesn’t.
But when I check the scene view it shows that they’re there.
Heres a video of my problem.
Heres the script for both teleporters:
using Cinemachine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class teleportation : MonoBehaviour
{
public Transform tp;
public Transform player;
public GameObject cam1;
public GameObject cam2;
public GameObject fadeEffect;
public Canvas joystick;
public GameObject tiles;
public GameObject enableTiles;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void joystickopen()
{
joystick.enabled = true;
fadeEffect.SetActive(false);
}
public void tping()
{
player.transform.position = tp.transform.position;
cam1.GetComponent<CinemachineVirtualCamera>().enabled = false;
cam2.GetComponent<CinemachineVirtualCamera>().enabled = true;
tiles.SetActive(false);
enableTiles.SetActive(true);
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.tag == "player")
{
joystick.enabled = false;
fadeEffect.SetActive(true);
Invoke(nameof(tping), 0.5f);
Invoke(nameof(joystickopen), 0.5f);
}
}
}