- Home /
Question by
santosh810666 · Dec 28, 2012 at 08:47 AM ·
c#javascriptwebsyntax
java to c#
function Start () { var webcamTexture : WebCamTexture = WebCamTexture(); renderer.material.mainTexture = webcamTexture; webcamTexture.Play();
} can any one convert this to c# please
Comment
Best Answer
Answer by SarperS · Dec 28, 2012 at 05:49 PM
using UnityEngine;
public class YourScriptNameHere : MonoBehaviour {
private void Start() {
var webcamTexture = new WebCamTexture();
renderer.material.mainTexture = webcamTexture;
webcamTexture.Play();
}
}
Looks like you made the same mistake as me and missed the new in front of WebCamTexture()
Oh I just copied and pasted your code inside the class there, you're right.
Answer by whydoidoit · Dec 28, 2012 at 08:48 AM
void Start()
{
var webcamTexture = new WebCamTexture();
renderer.material.mainTexture = webcamTexture;
webcamTexture.Play();
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613090029im_/https://answers.unity.com/themes/thub/images/avi.jpg)