Hello,
I have been searching all over for a way to bring up a webpage in Unity for mobile. I found a plugin but it doesn’t support Android and iOS. Is there a solution for this? I’d like to bring up a simple page and a Google Maps page.
Hello,
I have been searching all over for a way to bring up a webpage in Unity for mobile. I found a plugin but it doesn’t support Android and iOS. Is there a solution for this? I’d like to bring up a simple page and a Google Maps page.
You can use Application.OpenURL to open a website in the default web browser on any platform:
Here is a simple implentation:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="WebInterface.cs" company="Supyrb">
// Copyright (c) 2017 Supyrb. All rights reserved.
// </copyright>
// <author>
// Johannes Deml
// send@johannesdeml.com
// </author>
// --------------------------------------------------------------------------------------------------------------------
using UnityEngine;
using System.Collections;
namespace Supyrb
{
public class WebInterface : MonoBehaviour
{
public void OpenWebsite(string url)
{
Application.OpenURL(url);
}
}
}
With that script it is really easy to use it with ui:
