Change boolean from another script c#

I want to use my boolean from another script, the principal script on the player and the other on a spawning prefab (like a bullet) :
public class ScriptOne : MonoBehaviour
{
public bool Example;
}

public class ScriptTwo : MonoBehaviour
{
void Update()
{
if (GameObject.Find(“Player”).GetComponent().Example)
{
//Do Stuff
}
}
}

I understand you’re spawning prefab objects and want them to reference a boolean property of a script on another object (the player).

1st, don’t use GetComponent() in Update(), it has a cost and will have pretty bad consequences on performances.

public class Bullet : MonoBehaviour
{
    PlayerComponent playerComponent; // reference the player component
    // initialise your reference in Awake ()
    void Awake ()
    {
    // if there are several PlayerComponents in the scene and you want only the one on the GameObject "Player", use GameObject.Find()
    playerComponent = GameObject.Find("Player").GetComponent<PlayerComponent>();
    // otherwise, simply use GetObjectOfType()
    playerComponent = GetObjectOfType<PlayerComponent>();
    }

    void Update ()
    {
        // then reference the boolMember
        if (playerComponent.boolMember)
        {
            //Do Stuff
        }
    }
}

Now, if you only have one instance of your PlayerComponent at a time, you can also declare this bool as static, and reference it like this :

public class Bullet : MonoBehaviour
{
    void Update ()
    {
        // a static member is accessed on the Class, not on an instance
        if (PlayerComponent.boolMember)
        {
            //Do Stuff
        }
    }
}

Example this is script yes? If yes use like this:
GameObject.Find(“Player”).GetComponent().Example.yourBool = true/false; ??

If no im sorry i don`t know :confused: