纳金网
标题:
Awesomium结合Unity3D实现显示网页的效果简介教程
[打印本页]
作者:
驰骋的风
时间:
2011-11-24 10:02
标题:
Awesomium结合Unity3D实现显示网页的效果简介教程
在unity3d中显示网页的效果实现又多了一个不错的选择,下面是一个简介的使用教程!
This a quick introductory tutorial to using Awesomium with Unity3D.
We’ll walk you through the basics and demonstrate how to display a simple web-page in your 3D scene.
Web-Page Displayed in Unity3D using Awesomium
Checklist
Before we start, you will need the following things:
Unity Editor
(Basic or Pro)
Awesomium SDK
UnityAwe ZIP
— Unity3d Wrapper for Awesomium
Adding Awesomium to Unity3D on Windows:
We will first need to install the Awesomium SDK and then copy over some files so our scripts will***n within the Unity3D editor:
Install the Awesomium SDK using the default settings (should create a new folder on your Desktop)
Open the
awesomium
_
v1.6.x
_
sdk
_
win
folder and navigate to
buildin
elease
.
Copy
everything
from the
release
folder to
C
rogram FilesUnityEditor
(or for 64-bit Windows, copy it to
C
rogram Files (x86)UnityEditor
)
Now the Unity Editor has access to Awesomium, allowing you to use it while you debug scenes.
Adding Awesomium to Unity3D on Mac:
We will first need to install the Awesomium SDK and then copy over some files so our scripts will***n within the Unity3D editor:
Install and mount the Awesomium SDK
Open up the mounted SDK folder and navigate to
build/bin/release
Copy
Awesomium.framework
to
/Applications/Unity/Unity.app/Contents/Frameworks
(you’ll need to right-click Unity -> Show Package Contents)
Now the Unity Editor has access to Awesomium, allowing you to use it while you debug scenes.
Setting Up Your Unity3D Project:
Now it’s time to setup a new Unity3D project, add our plane object and directional light object.
Create a new folder on your Desktop and name it
UnityAweDemo
Open Unity3D, go to
File
->
New Project
->
Browse
-> select the
UnityAweDemo
folder ->
Create
Create a plane object by clicking
GameObject
->
Create Other
->
Plane
Edit the plane’s properties in the
Inspector
pane (see screenshot below)
The plane's Inspector properties
We now need to create a light source for our scene.
Click
GameObject
->
Create Other
->
Directional Light
Edit the directional light’s properties in the
Inspector
pane (see screenshot below)
The directional light's Inspector properties
Adding Our Scripts:
Last, we’ll need to add AwesomiumMono.dll and the C# scripts included in the UnityAwe wrapper to our Unity3D project.
Download UnityAwe from
https://github.com/khrona/UnityAwe/zipball/master
Unzip the UnityAwe archive.
Open it up and find the correct AwesomiumMono.dll for your platform (we have two separate builds for Windows and Mac).
Click and drag
AwesomiumMono.dll
to the
Project
pane in the Unity Editor.
Click and drag
WebTexture.cs
and
WebCoreHelper.cs
to the
Project
pane in the Unity3D editor.
Sweet, now your project is all set-up to use Awesomium! To actually make our plane display a web-page we just need to do two final steps:
Click and drag the
WebTexture.cs
script from the
Project
pane onto the
Plane
game object in the
Hierarchy
pane.
You should now see a
Web Texture (Script)
section in the
Inspector
pane, feel free to modify any of the default fields (such as
Initial URL
).
Awesome, you’re done!
Press the
Play
button and you should see a your Plane displaying a web-page. You should be able to interact with it like normal (mouse clicks, keyboard, etc.).
An Interactive webpage inside the Unity Editor
Extra Tips and Tricks:
You can click and drag
WebTexture.cs
to almost any Game Object to make it display a web-page as its texture.
When adding it to a
GUI Element
make sure to make the Width and Height (see the
Pixel Inset
) matches the values defined in your
Web Texture (Script)
.
When adding it to any other object (like a Cylinder or Sphere), make sure that it uses a
Mesh Collider
so that mouse input works correctly.
We will be continuing this tutorial in Part 2 with a more advanced example (scripting and HTML GUI goodness).
转自:http://labs.awesomium.com/unity3d-integration-tutorial-part-1/
If you need any help, drop us a line in our support f***m: http://support.awesomium.com
来源:http://www.unity3d8.com/content/awesomium%E7%BB%93%E5%90%88unity3d%E5%AE%9E%E7%8E%B0%E6%98%BE%E7%A4%BA%E7%BD%91%E9%A1%B5%E7%9A%84%E6%95%88%E6%9E%9C%E7%AE%80%E4%BB%8B%E6%95%99%E7%A8%8B
作者:
菜刀吻电线
时间:
2012-3-21 23:29
先垫一块,再说鸟
作者:
tc
时间:
2012-7-24 23:19
“再次路过……”我造一个-----特别路过
作者:
tc
时间:
2012-8-30 00:52
非常感谢,管理员设置了需要对新回复进行审核,您的帖子通过审核后将被显示出来,现在将转入主题
作者:
菜刀吻电线
时间:
2012-10-7 23:20
不错哦,谢谢楼主
作者:
奇
时间:
2012-10-18 23:23
谢谢楼主,真是太实用了
作者:
xxiixx
时间:
2013-6-19 18:01
为何mac上报错。
作者:
lanzhixing
时间:
2013-6-20 00:08
似乎64位的操作系统不能用?
作者:
cc386725
时间:
2017-2-16 13:13
64位的windows是一个难言的痛 ~~
欢迎光临 纳金网 (http://rs.narkii.com/club/)
Powered by Discuz! X2.5