EDIT: Now that some uneducated folk ruled me out, I am going to edit this post.
Problem: Okay, the problem is shown in the title. Basically, I’m working on this game and nothing works. Well, movement does but colliders disabling doesn’t.
I’ve tried to fix this problem, and even used the Unity Bug Report system to help (I obviously haven’t been on Unity for very long, and I think people should stop being rude and stupid af and embrace that). However, all the Unity team did was file it as an incident.
I’m not calling the Unity Team stupid or anything, or useless because they never helped, because I know that they have their own problems to deal with. So I’m requesting help from you guys.
Basically, here’s all the code. I’ll try to explain it without adding comments and making this look like a garbled mess.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WallWithHole : MonoBehaviour
{
public GameObject WallWithHoleTile;
public GameObject Player;
int PlayerLayer;
public int WallWithHoleLayer;
private void OnCollisionEnter2D(Collider2D collision)
{
if (collision.tag == "Player")
{
PlayerLayer = Player.GetComponent<PlayerMovement>().Layer;
if (WallWithHoleLayer == PlayerLayer)
{
WallWithHoleTile.SetActive(true);
}
else
{
WallWithHoleTile.SetActive(false);
}
}
}
}
Firstly, there are two GameObjects. One which is the Player, and another one which is the WallWithHoleTile’s collider.
In the private void
section where the WallWithHole Tile checks if the player is touching the tile or not, the WallWithHoleTile checks for the player’s Layer number. The Player has a function which returns its own Layer number.
It is supposed to detect where the player is via the Layer number.
However, when the Player’s Layer number and the WallWithHoleTile’s Layer number are equal, nothing happens.
Again, I can’t fix this. So I’m requesting help. Also if you want the files, I could give it to you so you can analyze the code deeper. This is a bit vague.
(Also geez, the users on this Forum are kind of rude af and toxic as hell.)