- Home /
customize a unity texture from within flash/flex
hi i'd like to have a flash/flex app coexist with a unity app on one web page and have the flash/flex app to style a texture according to user input. then have the customized texture being applied to a unity model at runtime. how can that be done?
Answer by jonas-echterhoff · Nov 18, 2009 at 10:44 AM
As Unity supports interaction with the JavaScript on the web site, you could in theory encode your texture as a string, and then pass that to a function in Unity from the Flash content using a JavaScript call. See docs for details.
Either that, or upload the texture to a server, and download it from Unity (which would be a waste of bandwidth, of course).
jonas, thanks for the hint. you say "in theory". do you consider this approach to be a practical approach as well?
Yes, it should be practical, unless you require some high texture bandwidth - ie, it would certainly be to slow to stream a movie from flash to unity, because of all the overhead involved. Plus, I never tried it myself, so you never know what kind of fun challenges you run into :)
Answer by PaulT · Nov 18, 2009 at 09:33 PM
This is something that I want to find out, but never got the time and need to do it. I think the way to go is to use Base64 encoding and decoding.
A simplistic solution that is guaranteed to work is to upload the bitmapdata from Flash to a server and load that same image from Unity after completing the upload. It's not efficient, but it could serve as an alternative solution if it will not work through javascript.
[update] Just saw that my last suggestion was already given.
Answer by burnumd · Jan 28, 2010 at 09:14 PM
You might check out what the folks at Aquiris have done with u3dobject. It's a swfobject like set of scripts for communicating with Javascript on a page or to flash content. Any communication you do is going to have to happen through the Javascript on the page, this framework just simplifies some tasks. Be aware, though, that to load a file directly from Unity, you'd have to serialize it as a string and recreate it in Unity or have your Flash/Flex store the image somewhere accessible and pull it down in Unity using the www class.
Your answer
Follow this Question
Related Questions
Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers
Mac webplayer graphic glitch 1 Answer
How to correctly size Unity web player using aspect ratio? 0 Answers
No Anti-Aliasing in webplayer 1 Answer
[SCREENSHOT] Why are my lighmapped shadows so blurry? 2 Answers