- Home /
Compiler errors while switching to android
I had it set to web player and had no compiller errors now that i switch to android i come up with this
Assets/Scripts/VideoController.cs(9,17): error CS0246: The type or namespace name `MovieTexture' could not be found. Are you missing a using directive or an assembly reference?
my code for VideoController.cs is
using UnityEngine;
using System.Collections;
public class VideoController : MonoBehaviour {
// Use this for initialization
void Start () {
MovieTexture movie = renderer.material.mainTexture as MovieTexture;
movie.Play();
}
// Update is called once per frame
void Update () {
}
}
Answer by vexe · Sep 14, 2013 at 09:34 AM
This means that the compiler couldn't find the MovieTexture
class anywhere within your project. Are you sure it's there?
EDIT: So you're a JS coming to C#, first watch some C# tutorials.
When you write your script in JS (say myScript.js), you'll get a blank script that looks like this:
function Start()
{
}
function Update()
{
}
You are actually writing inside a class
, but you don't know it. The equivalent of this in C#:
public class myScript : MonoBehaviour
{
// *
void Start()
{
}
void Update()
{
}
// *
}
What's between the '*' is what you get in JS. So, go to Unity, create a new C# script, name it MovieTexture
- and write your code inside it.
Or if you wanna write the class in the same file, just get out of the scope of the current class and do
class MovieTexture
{
// your stuff goes here...
}
EDIT: I haven't used MovieTexture before so I thought it's a user-defined class.
This is the only script I have to play the movie. How do I create a $$anonymous$$ovieTexture class that will fix this error. I am more confortable with javascript than c# so I have no idea
http://docs.unity3d.com/Documentation/$$anonymous$$anual/VideoFiles.html
You should read it, movie textures are not supported by Android/iOS at the bottom.
uh oh Androids cant use it now im screwed because i have invisible buttons with the buttons for the user in the video
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Compiler error while switching to android 1 Answer
Gradle build faild. see... error "in unity 2020.1.4f1!!!" 0 Answers
Problem with Mono compiler 0 Answers
Character Movement Problem 0 Answers