.SetActive(true) not working

So, I’ve been searching for a solution for some time, and have found a lot of similar posts with slightly different errors, so I will get out of the way that A) I have not disabled the gameobject, or parent of the gameobject in which the script is contained, and B) I am not using .Find(“Name”) or something of the like to reference my gameobject - it is declared as a public variable and asigned in the inspector.

My Script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Equip : MonoBehaviour
{
public GameObject item;
public GameObject holster;
private bool itemHolstered;

private void unHolster()
{
item.SetActive(true);
holster.SetActive(false);
itemHolstered = false;
}

private void Holster()
{
item.SetActive(false);
holster.SetActive(true);
itemHolstered = true;
}
// Start is called before the first frame update
void Start()
{
Holster();
}

// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(“x”))
{
if (itemHolstered == false)
{
unHolster();
}
else if (itemHolstered == true)
{
Holster();
}
}
}
}

The gameobjects being assigned in the inspector:
4999646--488528--upload_2019-9-25_16-44-3.png

And the gameobjects in the hierarchy - Note Equip is the gameobject to which the script is attached
4999646--488531--upload_2019-9-25_16-45-24.png

Any help would be greatly apreciated as I am thoroughly stumpted.

Looks like you have your itemHolstered if/else flipped? You unholster if it’s false and holster if it’s true but that seems backwards to what you want.

Yep, what @GroZZleR said.

thanks, I would have been staring at that for hours before I noticed

You can also save some code by adding a bool to your method;

        private void Holster(bool holstered)
        {
            item.SetActive(!holstered);
            holster.SetActive(holstered);
            itemHolstered = holstered;
        }

        void Update()
        {
            if (Input.GetKeyDown("x"))
            {
                itemHolstered = !itemHolstered;

                Holster(itemHolstered);
            }
        }