Skip to main content
Tweeted twitter.com/StackGameDev/status/754865372675903488
there is no reason to be so confrontational
Source Link
user1430
user1430

I'm making an RPG in Unity3D and I am trying to make a script for a chest to open. So I built this script

NOTE: This is my method so please don't try to make! But it better by using your own or be a complete jerk because I'm using JSdoesn't work. I just want some help fixing this script.

#pragma strict
var Text : GameObject;
var OpenedChest : GameObject;
var CurrentChest : GameObject;

function OnTriggerEnter()
{
    Text.SetActive(true);
    if (Input.GetKeyDown("e"))
    {
        CurrentChest.SetActive(false);
        OpenedChest.SetActive(true);
    }
}

function OnTriggerExit()
{
    Text.SetActive(false);
}

I get no compiler errors. When I go into the collider that triggers the text, that works, but what doesn't is when I press E to open the chest. It doesn't activate the other chest. What is wrong with my script?

I'm making an RPG in Unity3D and I am trying to make a script for a chest to open. So I built this script

NOTE: This is my method so please don't try to make it better by using your own or be a complete jerk because I'm using JS. I just want some help fixing this script.

#pragma strict
var Text : GameObject;
var OpenedChest : GameObject;
var CurrentChest : GameObject;

function OnTriggerEnter()
{
    Text.SetActive(true);
    if (Input.GetKeyDown("e"))
    {
        CurrentChest.SetActive(false);
        OpenedChest.SetActive(true);
    }
}

function OnTriggerExit()
{
    Text.SetActive(false);
}

I get no compiler errors. When I go into the collider that triggers the text, that works, but what doesn't is when I press E to open the chest. It doesn't activate the other chest. What is wrong with my script?

I'm making an RPG in Unity3D and I am trying to make a script for a chest to open. So I built this script! But it doesn't work. I just want some help fixing this script.

#pragma strict
var Text : GameObject;
var OpenedChest : GameObject;
var CurrentChest : GameObject;

function OnTriggerEnter()
{
    Text.SetActive(true);
    if (Input.GetKeyDown("e"))
    {
        CurrentChest.SetActive(false);
        OpenedChest.SetActive(true);
    }
}

function OnTriggerExit()
{
    Text.SetActive(false);
}

I get no compiler errors. When I go into the collider that triggers the text, that works, but what doesn't is when I press E to open the chest. It doesn't activate the other chest. What is wrong with my script?

I'm making an RPG in Unity3D and I am trying to make a script for a chest to open. So I built this script

NOTE: This is my method so please don't try to make it better by using your own or be a complete jerk because I'm using JS. I just want some help fixing this script.


 
#pragma strict
var Text : GameObject;
var OpenedChest : GameObject;
var CurrentChest : GameObject;

function OnTriggerEnter()
{
    Text.SetActive(true);
    if (Input.GetKeyDown("e"))
    {
        CurrentChest.SetActive(false);
        OpenedChest.SetActive(true);
    }
}

function OnTriggerExit()
{
    Text.SetActive(false);
}

 

I get no compiler errors. whenWhen I go into the collider that triggers the text, that works, but what doesn't is when I press E to open the chest. It doesn't activate the other chest. So can someone please help me fix this. You will be in the credits ofWhat is wrong with my game but you won't get any money.script?

I'm making an RPG in Unity3D and I am trying to make a script for a chest to open. So I built this script

NOTE: This is my method so please don't try to make it better by using your own or be a complete jerk because I'm using JS. I just want some help fixing this script.


 
#pragma strict
var Text : GameObject;
var OpenedChest : GameObject;
var CurrentChest : GameObject;

function OnTriggerEnter()
{
   Text.SetActive(true);
  if (Input.GetKeyDown("e"))
{
    CurrentChest.SetActive(false);
    OpenedChest.SetActive(true);
}
}

function OnTriggerExit()
{
   Text.SetActive(false);
}

 

I get no compiler errors. when I go into the collider that triggers the text, that works, but what doesn't is when I press E to open the chest. It doesn't activate the other chest. So can someone please help me fix this. You will be in the credits of my game but you won't get any money.

I'm making an RPG in Unity3D and I am trying to make a script for a chest to open. So I built this script

NOTE: This is my method so please don't try to make it better by using your own or be a complete jerk because I'm using JS. I just want some help fixing this script.

#pragma strict
var Text : GameObject;
var OpenedChest : GameObject;
var CurrentChest : GameObject;

function OnTriggerEnter()
{
    Text.SetActive(true);
    if (Input.GetKeyDown("e"))
    {
        CurrentChest.SetActive(false);
        OpenedChest.SetActive(true);
    }
}

function OnTriggerExit()
{
    Text.SetActive(false);
}

I get no compiler errors. When I go into the collider that triggers the text, that works, but what doesn't is when I press E to open the chest. It doesn't activate the other chest. What is wrong with my script?

I'm making an RPG in Unity3D and I am trying to make a script for a chest to open. So I built this script

NOTE: This is my method so please don't try to make it better by using your own or be a complete jerk because I'm using JS. I just want some help fixing this script.


#pragma strict
var Text : GameObject;
var OpenedChest : GameObject;
var CurrentChest : GameObject;

function OnTriggerEnter()
{
   Text.SetActive(true);
  if (Input.GetKeyDown("e"))
{
    CurrentChest.SetActive(false);
    OpenedChest.SetActive(true);
}
}

function OnTriggerExit()
{
   Text.SetActive(false);
}

var Text : GameObject; var OpenedChest : GameObject; var CurrentChest : GameObject;

function OnTriggerEnter() { Text.SetActive(true); if (Input.GetKeyDown("e")) { CurrentChest.SetActive(false); OpenedChest.SetActive(true); } }

function OnTriggerExit() { Text.SetActive(false); }


I get no compiler errors. when I go into the collider that triggers the text, that works, but what doesn't is when I press E to open the chest. It doesn't activate the other chest. So can someone please help me fix this. You will be in the credits of my game but you won't get any money.

I'm making an RPG in Unity3D and I am trying to make a script for a chest to open. So I built this script

NOTE: This is my method so please don't try to make it better by using your own or be a complete jerk because I'm using JS. I just want some help fixing this script.


#pragma strict

var Text : GameObject; var OpenedChest : GameObject; var CurrentChest : GameObject;

function OnTriggerEnter() { Text.SetActive(true); if (Input.GetKeyDown("e")) { CurrentChest.SetActive(false); OpenedChest.SetActive(true); } }

function OnTriggerExit() { Text.SetActive(false); }


I get no compiler errors. when I go into the collider that triggers the text, that works, but what doesn't is when I press E to open the chest. It doesn't activate the other chest. So can someone please help me fix this. You will be in the credits of my game but you won't get any money.

I'm making an RPG in Unity3D and I am trying to make a script for a chest to open. So I built this script

NOTE: This is my method so please don't try to make it better by using your own or be a complete jerk because I'm using JS. I just want some help fixing this script.


#pragma strict
var Text : GameObject;
var OpenedChest : GameObject;
var CurrentChest : GameObject;

function OnTriggerEnter()
{
   Text.SetActive(true);
  if (Input.GetKeyDown("e"))
{
    CurrentChest.SetActive(false);
    OpenedChest.SetActive(true);
}
}

function OnTriggerExit()
{
   Text.SetActive(false);
}

I get no compiler errors. when I go into the collider that triggers the text, that works, but what doesn't is when I press E to open the chest. It doesn't activate the other chest. So can someone please help me fix this. You will be in the credits of my game but you won't get any money.

Source Link
Loading