1. 首页
  2. 课程学习
  3. 游戏开发
  4. Flash 整合Unity3D 教程

Flash 整合Unity3D 教程

上传者: 2019-04-12 10:36:21上传 TXT文件 11.56KB 热度 26次
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, par ams, 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}); } ... }, ams, 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}); } ... },
用户评论
码姐姐匿名网友 2019-04-12 10:36:21

非常感谢楼主的分享,讲的挺仔细的

码姐姐匿名网友 2019-04-12 10:36:21

确实是整合,整合了网上很多地方的资料,不过也算辛苦了,有些帮助的。

码姐姐匿名网友 2019-04-12 10:36:21

只能做参考,看了不到一半,要有很强的as3基础

码姐姐匿名网友 2019-04-12 10:36:21

可以使用,还算不错。

码姐姐匿名网友 2019-04-12 10:36:21

这个是写给程序猿看的,路线是讲清楚了,是否可行我还没有试过