Hi,
I’m trying to pop up an image from OnTriggerEnter with box colider trigger. How do I make it work? I’ve tried these scripts from an Ben Pitt answer but it won’t work:
function Update () {
Hide();
}
function Hide() {
guiTexture.enabled = false;
}
function Show(paper : Paper) {
if (!guiTexture.enabled) {
var t = paper.popupTexture;
var rect = Rect( -t.width/20, -t.height/20, t.width, t.height );
guiTexture.pixelInset = rect;
guiTexture.texture = t;
guiTexture.enabled = true;
}
}
function OnTriggerExit(otherCollider : Collider) {
Hide();
}
this one on a GuiTexture
and then:
var popupTexture : Texture2D;
private var paperPopup : PaperPopup;
function Start () {
paperPopup = FindObjectOfType(PaperPopup);
if (popupTexture == null) {
popupTexture = renderer.material.mainTexture;
}
}
function OnTriggerEnter(otherCollider : Collider) {
paperPopup.Show(this);
}
this script I’ve puted on a trigger object
Can anyone help?