[Create] -> [Shader]でshaderを下のような感じに書き換えて、MaterialにD&D。そのMaterialを適当なCubeとかにD&D。んで、Scriptから自分で定義した値に適当な値をぶっこむ。簡単です。
MyShader.shader
Shader "Custom/GLSL Shader" { Properties { _Point("a point in world space", Vector) = (0., 0., 0., 1.0) } SubShader { Pass { GLSLPROGRAM uniform vec4 _Point; #ifdef VERTEX void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; } #endif #ifdef FRAGMENT uniform vec4 _SinTime; //uniform vec4 _Point; void main() { // gl_FragColor = _SinTime; gl_FragColor = _Point; } #endif ENDGLSL } } }
ShaderController.cs
using UnityEngine; using System.Collections; public class ShaderController : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { var mx = Input.mousePosition.x / (float)Screen.width; var my = Input.mousePosition.y / (float)Screen.height; renderer.sharedMaterial.SetVector("_Point", new Vector4(mx, my, (mx + my)/2.0f, 1.0f)); } }