Created
March 10, 2012 17:13
-
-
Save Santarh/2012153 to your computer and use it in GitHub Desktop.
UnityWebPlayer - Texture CHANGE!!!! http://dl.dropbox.com/u/11910973/Unity/nyan/index.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JavaScript部分 | |
function set_texture() | |
{ | |
var unity = GetUnity(); | |
var url = document.my_form.url.value; | |
unity.SendMessage("Plane", "set_texture", url); | |
} | |
HTML部分 | |
<form name="my_form"> | |
<input type="url" name="url" value="http://" id="url"> | |
<input type="button" value="好きな画像に変更できるゾ" onclick="set_texture()"> | |
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class TestTexture : MonoBehaviour | |
{ | |
// Use this for initialization | |
void Start () | |
{ | |
} | |
// Update is called once per frame | |
void Update () | |
{ | |
this.transform.RotateAroundLocal( Vector3.forward, 1.0f * Time.fixedDeltaTime ); | |
} | |
IEnumerator set_texture( string url ) | |
{ | |
WWW www = new WWW( url ); | |
yield return www; | |
this.renderer.material.mainTexture = www.texture; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment