Hello, dear friends, I would like to put a button on my game to direct players to a URL address, I tried to do this script, but it didn’t work, returns parse error. (CS8025 error: parse error) could someone help me, any help would be of great value, the code can be in java.
Thank you very much
The script that I have is this:
using UnityEngine;
using System.Collections;
public class EnviarResposta : MonoBehaviour
{
void OnGUI()
{
DrawGuiBottom();
}
void DrawGuiBottom()
{
if ( GUI.Button( new Rect( Screen.width / 2 - 150, Screen.height - 40, 300, 30 ), "Enviar Resposta" ) )
{
Application.OpenURL( "http://www.marketfifelidade.com.br" );
}
}
The code is fine. The problem is your URL you are using. If you copy and paste the URL into a browser URL field, it does not find the page. I tried a couple different variations, but none of the URLs existed. If you change your URL string in your code to:
"http://www.unity3d.com"
…your code would work fine.
solved with this script , thank you very much
#pragma strict
private var displayMessage : boolean;
var Sound:AudioClip;
function OnTriggerEnter(other : Collider)
{
if(other.tag == "Player")
{ //audio.clip = Sound;
//audio.Play();
displayMessage = true;
audio.clip = Sound;
audio.Play();
}
}
function OnGUI()
{
if(displayMessage)
{
GUI.Box(Rect(5,5,Screen.width - 800, Screen.height - 600),"A chave que abre esta porta, possui
uma das cores deste país que tem
99,9% da sua população professada
por xiitas e sunitas, sua seleção foi
classificada para a Copa de 2014.
Você poderá encontrar dicas para
resolver um enigma. Mas você terá grandes
chances se comprar em lojas participantes
deste projeto social. ");
if(GUI.Button(Rect(Screen.width/3 - 100,Screen.height - Screen.height/2.5,150,50),"APAGAR"))
{
displayMessage = false;
}
if(GUI.Button(Rect(Screen.width/3*2 - 100,Screen.height - Screen.height/2.5,150,50),"ENVIAR RESPOSTA
PARA SITE"))
{
Application.OpenURL("http://www.marketfidelidade.com.br");
}
}
}