Home › Forums › Syphon › Syphon Implementations – User › Unity issues › Reply To: Unity issues
Here is an updated script to solve that issue:
using UnityEngine;
using System.Collections;public class makeSyphonClientWork : MonoBehaviour {
//ridiculously dumb fix courtesy of brian [at] chasalow [dot] c o m
//attach this script to the main camera.
//then attach your SyphonClientBridge to whatever objects (plane, etc) you want to receive the texture on.
public string infos = "attachToMainCameraPlz!";
void Start () {
}static Material lineMaterial;
static void CreateLineMaterial() {
if( !lineMaterial ) {
lineMaterial = new Material( "Shader "Lines/Colored Blended" {" +
"SubShader { Pass { " +
" Blend SrcAlpha OneMinusSrcAlpha " +
" ZWrite Off Cull Off Fog { Mode Off } " +
" BindChannels {" +
" Bind "vertex", vertex Bind "color", color }" +
"} } }" );
lineMaterial.hideFlags = HideFlags.HideAndDontSave;
lineMaterial.shader.hideFlags = HideFlags.HideAndDontSave;
}
}void OnPostRender() {
CreateLineMaterial();
lineMaterial.SetPass( 0 );
}void OnRenderObject() {
CreateLineMaterial();
lineMaterial.SetPass( 0 );}
}