I have two script in the firs i have a public bool Pippo.
in the second script I want to do something if pippo is true. How i can do that if I use getcomponent it doesn’t work
this is the first script
public class PlatformerCharacter2D : MonoBehaviour
{
public bool m_FacingRight = true;
this is the second
namespace GameAssets._2D
{
public class ArmRotation : MonoBehaviour
{
public int rotationOffset;
public float rotz;
public float MinRot;
public float MaxRot;
private PlatformerCharacter2D m_Character;
// Start is called before the first frame update
void Start()
{
m_Character = GetComponent<PlatformerCharacter2D>();
}
// Update is called once per frame
void Update()
{
rotation();
if (rotz>=MinRot && rotz<=MaxRot)
{
transform.rotation = Quaternion.Euler(0f, 0f, rotz + rotationOffset);
}
if(m_Character.m_FacingRight)
{
Dbug.LorWarning("some");
< }
//need to lock the rotation and reverse the arm when he walk left
}