文件名称:Flash 整合Unity3D 教程
文件大小:12KB
文件格式:TXT
更新时间:2015-12-23 15:07:41
Flash 整合Unity3D 教程
Flash 整合Unity3D 教程 例子 public class MyLoader extends Sprite implements IUnityContentHost { private var unityContentLoader:UnityContentLoader; public function MyLoader() { var params:UnityLoaderParams = new UnityLoaderParams(false,720,400,false); unityContentLoader = new UnityContentLoader("UnityContent.swf", this, params, false); unityContentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onUnityContentLoaderProgress); unityContentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onUnityContentLoaderComplete); unityContentLoader.loadUnity(); } private function onUnityContentLoaderProgress(eventrogressEvent):void { //Respond to load progress } private function onUnityContentLoaderComplete(event:Event):void { addChild(unityContentLoader); unityContentLoader.unityContent.setContentHost(this); } //unityInitStart has to be implemented by whatever implements IUnityContenthost //This is called when the content is loaded and the initialization of the unity engine is started. public function unityInitStart():void { //Unity engine started } //unityInitComplete has to be implemented by whatever implements IUnityContenthost //This is called when the unity engine is done initializing and the first level is loaded. public function unityInitComplete():void { unityContentLoader.unityContent.sendMessage("Main Camera","SetResponder",{responder:this}); } ... },