- Home /
How to open a web page(URL) inside a unity game ?
i want this to tweet my player's score from my game itself..i need to open twitter page inside my game..How can i do that ??/ Thank you
Answer by alankemp · Apr 29, 2016 at 12:36 PM
You can open any web page with Application.OpenURL("some website address here").
To post a twitter message specifically, you can try something like this:
string tweet = "Put a message to tweet here! #unity";
string URL = "http://twitter.com/intent/tweet?text=" + WWW.EscapeURL(tweet);
Application.OpenURL(URL);
For more functionality there are a number of assets on the asset store that will deal with posting to twitter, facebook and other social media platform. For example: https://www.assetstore.unity3d.com/en/#!/content/16415
@alankemp Thank you for you response.But OpenURL will open the browser or app in a new window. it will exit from the game window(app). i dont want my user to go out of my game.. i need my user to tweet within my game itself without going out of game.. i want the twitter app or browser to open within my game itself.. how can i do that???
You could try a plugin like uwebkit (from here: http://uwebkit.com/). That allows you to render a web page inside your own app.
Thank you..@Alan$$anonymous$$emp . Uwebkit if working fine for me .. but is there any default method or coding(c#) is there to display web pages . Can i interact with the web page in unity game without plugin or DLL( have to interact only with default method or codes(c#) )