Hello, just in case, yes im new to unity and blablabla,anyways
what I need is a way for this script to know if my player has the isGP variable active and then destroy whatever thing it needs (if y’all need the movement script I can give it)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TESTBreak : MonoBehaviour
{
[SerializeField] private Transform BreakCheck;
Referencing variables, fields, methods (anything non-static) in other script instances:
REMEMBER: it isn’t always the best idea for everything to access everything else all over the place. For instance, it is BAD for the player to reach into an enemy and reduce his health.
Instead there should be a function you call on the enemy to reduce his health. All the same rules apply for the above steps: the function must be public AND you need a reference to the class instance.
That way the enemy (and only the enemy) has code to reduce his health and simultaneously do anything else, such as kill him or make him reel from the impact, and all that code is centralized in one place.
Be sure you understand what you mean by “pass on the variable” because it makes a HUGE difference: