How can I enlarge the box collider when a prefab is active

I’m trying to enlarge a box collider when a prefab is spawned so it gives damage to the play but I don’t want the box collider there when the prefab isnt active.

This is the code so far:


public BoxCollider Flame;
public GameObject MegalothFlameManager;

// Use this for initialization
void Start () 
	Flame = Flame.GetComponent <MegalothFlameManager>();

// Update is called once per frame
void Update () 
	if (MegalothFlameManager = true); <<stuck here <<<
		Flame.size = new Vector3 (1f, 1f, 1f); = new Vector3 (1f, 1f, 1f);


Im stuck on the “if (MegalothFlameManager = true);” Ive come across tutorials but they’re all ontriggerenter and I don’t want that.

Any suggestions?

Right now you’re trying to compare two supposed game objects, i think that you should change your expression probably to this:

    if (MegalothFlameManager != null){
    Flame.enabled = true; //(With this you enable the collider)
    Flame.size = new Vector3 (1f, 1f, 1f);
    = new Vector3 (1f, 1f, 1f);
Flame.enabled = false;


That will check everyframe if your object is active or not, and if it is it will set active the collider. If it’s not it will be disabled. If you want to instantiate your prefab when the player crosses or something like that, check distance between the object and your player so if it is less than “X” your collider will be active

I think that should work if I actually understood your problem!