I did a quick proof of concept to move along some discussions we’ve been having. This is a little clumsy under the hood, but it is possible to do elegant Flash ↔ Unity communication:
http://www.flashbangstudios.com/tests/unityflash/
There are a few potential uses:
- Strong Flash UI integration
- Backend Flash integration (tying in to a Flash-only SDK, for instance)
- Whatever else… (Mochiads?)
I have also seen Advergames that use Flash to do a lot of the game setup–character selection, configuration, etc–and then switch to a non-Flash tech for the actual, passing along the settings.
[Edit: Fixed, should work in all browsers now]
Funny, I did the exact same thing yesterday and was readying to post. 
It does indeed work. What I haven’t come up with is a great Flash friendly format to pass data to and from Unity. XML is the obvious choice, but it’s a bit overkill for a lot of things it seems. It also probably involves using something like Mono mini XML so you don’t get the huge dll hit on the Unity side. I looked at the LoadVars class in Flash but it’s a bit crippled, not to mention stoopidly named. Maybe someone has a thought on this. 
Another thing this can be used for is saving preferences in the web player until its implemented in Unity, which I sure hope it will some day…
Cheers,
-Jon
I haven’t done any kind of stress testing yet, in terms of how fast you can do communication (how many times a second without impact, etc).
If it’s fast, though, you could just pass variables one at a time…
Wow, this is awesome! What’s most impressive (for me at least) is that the Unity ↔ Flash communication seems to be extremely fast / smooth. So could this be used to create a very cool 2D animated control panel for a vehicle displayed in Unity? Are you planning on sharing this or just trying to make us jealous? 
What’s wrong with LoadVars? I’ve used it to return some hefty chunks of data from PHP and MySQL. And writing a parser that produces a string in the format that LoadVars likes is very trival… especially when compared to farting around with XML. 
Cheers.
If you could manage the dll size with Unity, XML would be really nice – Actionscript 3 has some of the better XML support that I have seen.
As far as I can see, you can’t give it a string of data to parse, only a URL to download and parse. The former is needed for Flash<-Browser->Unity communication. Also, you can send along with “load” within the LoadVars class. I just think it’s named poorly and it’s needlessly inflexible. It’s one of those “use it to do exactly what we had in mind for it” type of things.
Cheers,
-Jon