How to hide a character prefab

Explanation of what I’m doing: I currently have a Player object with many scripts associated with it, then I have a graphics object as a child of that (the other child of that is the camera), and then I have a playerModel that will have multiple prefab children with animator controller and animatorw script. The scrip triggers animations. I have a script that toggles the weapons wielded and displays them on the right side of the camera. That is what the player will see. But I want everyone else to see the player animations and the player holding the weapon. The reason I made multiple prefabs was because I wanted to player prefab to be unique to that specific weapon and be able to grab it. I know where to add the code to hide the player prefab and show the rest of them ( already know it works this way because I have selected hide in the inspector and ran it and it works just fine, I just want the CODE to trigger the hiding, not have to manually do it by me)

TL;DR how to hide my game object
Player (1) > Graphics > playerModel > Model T pose 2
I want to hide Model T pose 2 in a script that is not necessarily attached to that specific object. I also want to show another variation of Model T Pose 2 once the other one is hidden. Please tell me how to access it to hide it from any script.

There are three ways to do such.

  • public references
  • GameObject.Find()
  • public static

If you have an object that is not placed at run time I would suggest using the public reference to the model. This be set up like

public GameObject model

From here just assign it to the empty box labeled “model” in the editor.
GameObject.FInd is good if you instantiate the object that is finding the model. You would use it like

GameObject model = GameObject.Find("Model T Pose 2")

A public static reference is a quicker way to find the model if you instantiated it, but it is a bit more complicated. First you would need a script on the model that simply said

public class ModelReference : MonoBehavior {
public static GameObject model;
void Awake() {

     model = this.gameObject;


from here you would just do something like

void getModel (){
GameObject model = ModelReference.model;

The public static method can only work if there is only one object with that script on it.

From here you would simply use model.setActive(false)

To change the model you could either change the mesh in the mesh filter or enable a new gameobject that is a sibling to model t pose 2.