Researching unity - got a few questions

Researching Unity - I have a few questions that I couldn’t answer from my reading of the manual.

  1. Is the web plugin able to access textures from a server when needed? rather than embedding them all?

  2. Is the engine able to display a specified frame from a movie texture based on player input?

  3. Is the engine able to change the texture assigned to a mesh on the fly?

I have a web based project where player input determines which textures that are displayed on a given mesh. There will be a large library of textures only a few of which will be used at any one time which is why I wanted to avoid players having to download them all each session.

cheers,
neil

#1 and #3 are definitely yes, while #2 is “not now, I don’t think”.

#3 is as simple as setting renderer.material.mainTexture to some other value.

#1 is a bit more complicated, in that you’d have to script it yourself using the WWW class. It wouldn’t be too hard to write a “On Load, set the material’s texture to this thing i’m downloading from this address” script that could be reused, but, it wouldn’t be the typical drag and drop that Unity’s good at.

I haven’t played with the video support yet but I don’t believe you can do that in 2.0.0. I have a feeling it’ll be in there in an upcoming version (video support is brand new, and you’re not the first to request this)

The MovieTexture class does not have a “frame” property that you can set or get, but there is sample code that uses such an property, so I’m guessing it got pulled at the last minute and will be back eventually. If not, you might consider the QuickTime texture plugin on the wiki.

Code like texture.frame is Unity 1.6.1 code, when textures supported (very short, small) videos - made for stuff like animated health bars. I’m honestly surprised that it was removed…

Duh! Me stupid. Thanks for the clarification, StarManta. I’ve repeated my idiocy in another thread, too! It does seem like an obvious oversight, for the exact same reason that texture.frame would be useful.

You can easily set the texture of a material each frame. The Texture2D.frame functionality has been deprecated, because it is better to assign the texture to the material instead. There is nothing you can’t do with this approach that you could do with texture.frame.

var texs : Texture[];
function Update () {
   material.mainTexture = texs[Random.Range(0, texs.length);]
}

It is better because for small repeating clips you will get much better performance. (The texture doesn’t have to be reuploaded to the graphics card when the frame changes).

It’s true that you can’t set a specific MovieTexture frame right now. It’s something we want to add at some point.

But streaming an image using the www class and assigning it to a material is like 3 lines of code.

Thanks a bunch for the info guys. As usual there’s always some way around these things. The set movie frame was the least critical anyway so I’m happy for the moment.
cheers
n