protected AudioSource PlaySound(AudioClip clip, float volume, float pitch) { if (clip != null) { if (m_Listener == null) { m_Listener = GameObject.FindObjectOfType(typeof(AudioListener)) as AudioListener; if (m_Listener == null) { Camera cam = Camera.main; if (cam == null) cam = GameObject.FindObjectOfType(typeof(Camera)) as Camera; if (cam != null) m_Listener = cam.gameObject.AddComponent<AudioListener>(); } } if (m_Listener != null) { AudioSource source = m_Listener.audio; if (source == null) source = m_Listener.gameObject.AddComponent<AudioSource>(); source.pitch = pitch; source.PlayOneShot(clip, volume); return source; } } return null; }
protected override void MapObjects() { //Main Camera GameObject gameObject12310 = new GameObject(); SetObject(12310, gameObject12310); Transform transform12316 = gameObject12310.transform; SetObject(12316, transform12316); UnityEngine.Camera component12314 = gameObject12310.AddComponent <UnityEngine.Camera>(); SetObject(12314, component12314); UnityEngine.AudioListener component12312 = gameObject12310.AddComponent <UnityEngine.AudioListener>(); SetObject(12312, component12312); //Directional Light GameObject gameObject12318 = new GameObject(); SetObject(12318, gameObject12318); Transform transform12322 = gameObject12318.transform; SetObject(12322, transform12322); UnityEngine.Light component12320 = gameObject12318.AddComponent <UnityEngine.Light>(); SetObject(12320, component12320); //bbgbfbdb GameObject gameObject_2144 = new GameObject(); SetObject(-2144, gameObject_2144); Transform transform_2146 = gameObject_2144.transform; SetObject(-2146, transform_2146); NewBehaviourScript1 component_2224 = gameObject_2144.AddComponent <NewBehaviourScript1>(); SetObject(-2224, component_2224); }
// Use this for initialization private void Start() { if (PlayerPrefs.GetInt("Nb change", 0) == 1) Destroy(change1); else if (PlayerPrefs.GetInt("Nb change", 0) == 2) { Destroy(change1); Destroy(change2); } DestroyChange(); Volume.value = 1; m_CharacterController = GetComponent<CharacterController>(); m_Camera = Camera.main; m_OriginalCameraPosition = m_Camera.transform.localPosition; m_FovKick.Setup(m_Camera); m_HeadBob.Setup(m_Camera, m_StepInterval); m_StepCycle = 0f; m_NextStep = m_StepCycle/2f; m_Jumping = false; m_AudioSource = GetComponent<AudioSource>(); m_MouseLook.Init(transform , m_Camera.transform); Listener = GetComponentInChildren<AudioListener>(); if (Application.loadedLevel == 1) m_CharacterController.transform.position = new Vector3(PlayerPrefs.GetFloat("Xpos", 21.9f), PlayerPrefs.GetFloat("Ypos",1),PlayerPrefs.GetFloat("Zpos", -23.32f)); m_CharacterController.transform.rotation= new Quaternion(PlayerPrefs.GetFloat("Xrot", 0), PlayerPrefs.GetFloat("Yrot", 0), PlayerPrefs.GetFloat("Zrot", 0),0); }
static public int set_velocityUpdateMode(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.AudioListener self = (UnityEngine.AudioListener)checkSelf(l); UnityEngine.AudioVelocityUpdateMode v; v = (UnityEngine.AudioVelocityUpdateMode)LuaDLL.luaL_checkinteger(l, 2); self.velocityUpdateMode = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
/// <summary> /// Read the data into the specified value. /// </summary> /// <param name="value">Value.</param> /// <param name="reader">Reader.</param> public override void ReadInto(object value, ISaveGameReader reader) { UnityEngine.AudioListener audioListener = (UnityEngine.AudioListener)value; foreach (string property in reader.Properties) { switch (property) { case "velocityUpdateMode": audioListener.velocityUpdateMode = reader.ReadProperty <UnityEngine.AudioVelocityUpdateMode> (); break; case "enabled": audioListener.enabled = reader.ReadProperty <System.Boolean> (); break; case "tag": audioListener.tag = reader.ReadProperty <System.String> (); break; case "name": audioListener.name = reader.ReadProperty <System.String> (); break; case "hideFlags": audioListener.hideFlags = reader.ReadProperty <UnityEngine.HideFlags> (); break; } } }
static public int constructor(IntPtr l) { UnityEngine.AudioListener o; o = new UnityEngine.AudioListener(); pushObject(l, o); return(1); }
static public int set_velocityUpdateMode(IntPtr l) { UnityEngine.AudioListener o = (UnityEngine.AudioListener)checkSelf(l); UnityEngine.AudioVelocityUpdateMode v; checkEnum(l, 2, out v); o.velocityUpdateMode = v; return(0); }
static public void FastSetter(this UnityEngine.AudioListener o, string propertyName, UnityEngine.AudioVelocityUpdateMode value) { switch (propertyName) { case "velocityUpdateMode": o.velocityUpdateMode = value; return; } LBoot.LogUtil.Error("UnityEngine.AudioListener no Setter Found : " + propertyName); }
static public void FastSetter(this UnityEngine.AudioListener o, string propertyName, System.Boolean value) { switch (propertyName) { case "enabled": o.enabled = value; return; } LBoot.LogUtil.Error("UnityEngine.AudioListener no Setter Found : " + propertyName); }
/// <summary> /// Write the specified value using the writer. /// </summary> /// <param name="value">Value.</param> /// <param name="writer">Writer.</param> public override void Write(object value, ISaveGameWriter writer) { UnityEngine.AudioListener audioListener = (UnityEngine.AudioListener)value; writer.WriteProperty("velocityUpdateMode", audioListener.velocityUpdateMode); writer.WriteProperty("enabled", audioListener.enabled); writer.WriteProperty("tag", audioListener.tag); writer.WriteProperty("name", audioListener.name); writer.WriteProperty("hideFlags", audioListener.hideFlags); }
static public int get_velocityUpdateMode(IntPtr l) { try { UnityEngine.AudioListener self = (UnityEngine.AudioListener)checkSelf(l); pushEnum(l, (int)self.velocityUpdateMode); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { UnityEngine.AudioListener o; o = new UnityEngine.AudioListener(); pushValue(l, o); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { UnityEngine.AudioListener o; o=new UnityEngine.AudioListener(); pushValue(l,true); pushValue(l,o); return 2; } catch(Exception e) { return error(l,e); } }
static public int set_velocityUpdateMode(IntPtr l) { try { UnityEngine.AudioListener self = (UnityEngine.AudioListener)checkSelf(l); UnityEngine.AudioVelocityUpdateMode v; checkEnum(l, 2, out v); self.velocityUpdateMode = v; return(0); } catch (Exception e) { return(error(l, e)); } }
static int set_al(IntPtr L) { try { UnityEngine.AudioListener arg0 = (UnityEngine.AudioListener)ToLua.CheckObject(L, 2, typeof(UnityEngine.AudioListener)); PreLoadingScene.al = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public static int constructor(IntPtr l) { try { UnityEngine.AudioListener o; o=new UnityEngine.AudioListener(); pushValue(l,o); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } }
static public int constructor(IntPtr l) { LuaDLL.lua_remove(l, 1); UnityEngine.AudioListener o; if (matchType(l, 1)) { o = new UnityEngine.AudioListener(); pushObject(l, o); return(1); } LuaDLL.luaL_error(l, "New object failed."); return(0); }
static public int constructor(IntPtr l) { try { UnityEngine.AudioListener o; o = new UnityEngine.AudioListener(); pushValue(l, o); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
protected AudioSource PlaySound(AudioClip clip, float volume, float pitch) { //apply global sound config volume *= Xft.GlobalConfig.SoundVolume; if (clip != null) { if (m_Listener == null) { m_Listener = GameObject.FindObjectOfType(typeof(AudioListener)) as AudioListener; if (m_Listener == null) { Camera cam = Camera.main; if (cam == null) cam = GameObject.FindObjectOfType(typeof(Camera)) as Camera; if (cam != null) m_Listener = cam.gameObject.AddComponent<AudioListener>(); } } if (m_Listener != null) { AudioSource source = m_Listener.audio; if (source == null) source = m_Listener.gameObject.AddComponent<AudioSource>(); source.pitch = pitch; source.loop = m_owner.IsSoundLoop; if (!m_owner.IsSoundLoop) { source.PlayOneShot(clip, volume); } else { source.clip = clip; source.volume = volume; source.Play(); } //Debug.LogWarning(GameTools.GetPath(m_owner.gameObject.transform)); return source; } } return null; }
static void AudioListener_velocityUpdateMode(JSVCall vc) { if (vc.bGet) { UnityEngine.AudioListener _this = (UnityEngine.AudioListener)vc.csObj; var result = _this.velocityUpdateMode; JSApi.setEnum((int)JSApi.SetType.Rval, (int)result); } else { UnityEngine.AudioVelocityUpdateMode arg0 = (UnityEngine.AudioVelocityUpdateMode)JSApi.getEnum((int)JSApi.GetType.Arg); UnityEngine.AudioListener _this = (UnityEngine.AudioListener)vc.csObj; _this.velocityUpdateMode = arg0; } }
static public void FastSetter(this UnityEngine.AudioListener o, string propertyName, object value) { switch (propertyName) { case "velocityUpdateMode": o.velocityUpdateMode = (UnityEngine.AudioVelocityUpdateMode)value; return; case "tag": o.tag = (System.String)value; return; case "enabled": o.enabled = (bool)value; return; } LBoot.LogUtil.Error("UnityEngine.AudioListener no Setter Found : " + propertyName); }
static int set_velocityUpdateMode(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.AudioListener obj = (UnityEngine.AudioListener)o; UnityEngine.AudioVelocityUpdateMode arg0 = (UnityEngine.AudioVelocityUpdateMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.AudioVelocityUpdateMode)); obj.velocityUpdateMode = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index velocityUpdateMode on a nil value")); } }
static int get_AudioListener(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Arthas.SoundCompoent obj = (Arthas.SoundCompoent)o; UnityEngine.AudioListener ret = obj.AudioListener; ToLua.PushSealed(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index AudioListener on a nil value")); } }
static int set_AudioListener(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Arthas.SoundCompoent obj = (Arthas.SoundCompoent)o; UnityEngine.AudioListener arg0 = (UnityEngine.AudioListener)ToLua.CheckObject(L, 2, typeof(UnityEngine.AudioListener)); obj.AudioListener = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index AudioListener on a nil value")); } }
static int get_velocityUpdateMode(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.AudioListener obj = (UnityEngine.AudioListener)o; UnityEngine.AudioVelocityUpdateMode ret = obj.velocityUpdateMode; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index velocityUpdateMode on a nil value")); } }
public void Initialize(PureData pureData) { listener = Object.FindObjectOfType<AudioListener>(); if (listener == null) { GameObject newListener = new GameObject("Listener"); listener = newListener.AddComponent<AudioListener>(); listener.transform.Reset(); Logger.LogWarning("No listener was found in the scene. One was automatically created."); } // HACK Trick to activate OnAudioFilterRead listener.enabled = false; filterRead = listener.GetOrAddComponent<PureDataFilterRead>(); filterRead.Initialize(pureData); listener.enabled = true; transform = listener.transform; }
public List<AudioSource>[] playersForClipId = new List<AudioSource>[SOUND.COUNT]; // 音效播放器 /// <summary> /// 创建音效播放器和音乐播放器 /// </summary> void Awake() { //防止被销毁 DontDestroyOnLoad (gameObject); listener = gameObject.AddComponent<AudioListener> (); musicPlayer = gameObject.AddComponent<AudioSource> (); for (int i = 0; i < playersForClipId.Length; i++) { playersForClipId [i] = new List<AudioSource> (1); playersForClipId [i].Add(gameObject.AddComponent<AudioSource> ()); } audio = GetComponent<AudioSource>(); if (null == audio) { audio = gameObject.AddComponent<AudioSource> (); } }
private GameObject mainCamera_Init() { GameObject gomainCamera_12566 = (GetObject(12566) as GameObject); gomainCamera_12566.name = "Main Camera"; gomainCamera_12566.tag = "MainCamera"; UnityEngine.Transform commainCamera_transform_0_12572 = (GetObject(12572) as UnityEngine.Transform); commainCamera_transform_0_12572.position = new Vector3(0f, 1f, -10f); commainCamera_transform_0_12572.localPosition = new Vector3(0f, 1f, -10f); commainCamera_transform_0_12572.tag = "MainCamera"; UnityEngine.Camera commainCamera_camera_0_12570 = (GetObject(12570) as UnityEngine.Camera); commainCamera_camera_0_12570.depth = -1f; commainCamera_camera_0_12570.layerCullDistances = new System.Single[] { 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f }; commainCamera_camera_0_12570.cullingMatrix = new Matrix4x4(new Vector4(0.9761558f, 0f, 0f, 0f), new Vector4(0f, 1.732051f, 0f, 0f), new Vector4(0f, 0f, 1.0006f, 1f), new Vector4(0f, -1.732051f, 9.405821f, 10f)); commainCamera_camera_0_12570.worldToCameraMatrix = new Matrix4x4(new Vector4(1f, 0f, 0f, 0f), new Vector4(0f, 1f, 0f, 0f), new Vector4(0f, 0f, -1f, 0f), new Vector4(0f, -1f, -10f, 1f)); commainCamera_camera_0_12570.tag = "MainCamera"; UnityEngine.AudioListener commainCamera_audiolistener_0_12568 = (GetObject(12568) as UnityEngine.AudioListener); commainCamera_audiolistener_0_12568.velocityUpdateMode = UnityEngine.AudioVelocityUpdateMode.Dynamic; commainCamera_audiolistener_0_12568.tag = "MainCamera"; return(gomainCamera_12566); }
static int _CreateUnityEngine_AudioListener(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { UnityEngine.AudioListener obj = new UnityEngine.AudioListener(); ToLua.PushSealed(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.AudioListener.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public object FastGetter(this UnityEngine.AudioListener o, string propertyName) { switch (propertyName) { case "velocityUpdateMode": return(o.velocityUpdateMode); case "transform": return(o.transform); case "gameObject": return(o.gameObject); case "tag": return(o.tag); case "enabled": return(o.enabled); } LBoot.LogUtil.Error("UnityEngine.AudioListener no Getter Found : " + propertyName); return(null); }
protected override void MapObjects() { //Main Camera GameObject gameObject12228 = new GameObject(); SetObject(12228, gameObject12228); Transform transform12234 = gameObject12228.transform; SetObject(12234, transform12234); UnityEngine.Camera component12232 = gameObject12228.AddComponent <UnityEngine.Camera>(); SetObject(12232, component12232); UnityEngine.AudioListener component12230 = gameObject12228.AddComponent <UnityEngine.AudioListener>(); SetObject(12230, component12230); //Directional Light GameObject gameObject12236 = new GameObject(); SetObject(12236, gameObject12236); Transform transform12240 = gameObject12236.transform; SetObject(12240, transform12240); UnityEngine.Light component12238 = gameObject12236.AddComponent <UnityEngine.Light>(); SetObject(12238, component12238); }
protected virtual void Start() { if (onIconActivatePlayAudio) { cachedAudioListener = FindObjectOfType(typeof(AudioListener)) as AudioListener; if (cachedAudioListener == null) { Debug.LogError("Cannot find an audio listener for this scene. Audio will not be played"); } } if (Application.isPlaying) { bool looked = false; if (lookAtLastLevel) { looked = LookAtLastPlayedLevel(); } if (!looked) { // need to look at other type of level LookAtLevel(); } } }
/** * Updates the current remote audio listener. We need to attach a component to the game object * marked as the remote audio listener. It is possible to swap audio listeners at runtime. * We disable the attached component on the object that is no longer active. Either parameter * can be null. */ public void UpdateAudioListener(AudioListener previouslistener, AudioListener newlistener) { CastRemoteDisplayAudioInterceptor previousInterceptor = previouslistener == null ? null : previouslistener.GetComponent<CastRemoteDisplayAudioInterceptor>(); CastRemoteDisplayAudioInterceptor newInterceptor = newlistener == null ? null : newlistener.GetComponent<CastRemoteDisplayAudioInterceptor>(); // If we have a valid listener that doesn't have an interceptor yet, add it. if (newInterceptor == null && newlistener != null) { newInterceptor = newlistener.gameObject.AddComponent<CastRemoteDisplayAudioInterceptor>(); } if (previousInterceptor != null && previousInterceptor != newInterceptor) { previousInterceptor.enabled = false; } if (newInterceptor != null) { newInterceptor.SetCastRemoteDisplayExtensionManager(this); newInterceptor.enabled = true; } }
/// <summary> /// Read the data using the reader. /// </summary> /// <param name="reader">Reader.</param> public override object Read(ISaveGameReader reader) { UnityEngine.AudioListener audioListener = SaveGameType.CreateComponent <UnityEngine.AudioListener> (); ReadInto(audioListener, reader); return(audioListener); }
public void CreateCamera() { this.MainCamera = UnityEngine.Camera.main; this.MainCameraFOV = this.MainCamera.fieldOfView; if (this.CameraFoV == 0) { this.CameraFoV = this.MainCameraFOV; } if (this.CameraNearClip == 0) { this.CameraNearClip = this.MainCamera.nearClipPlane; } if (this.CameraForClip == 0) { this.CameraForClip = this.MainCamera.farClipPlane; } this.MainCamera.enabled = false; // free camera on this.MainCamera.GetComponent <RideCameraController>().ONGNOMCJBGE = true; // copy camera object this.CameraObject = UnityEngine.Object.Instantiate(this.MainCamera.gameObject); this.CameraObject.name = "Camera"; this.Camera = this.CameraObject.GetComponent <UnityEngine.Camera>(); this.Camera.enabled = true; this.CameraTransform = this.CameraObject.transform; if (this.RootObject != null) { this.CameraTransform.SetParent(this.RootObject.transform); } this.CameraObject.transform.position = this.MainCamera.transform.position; // delete components UnityEngine.AudioListener audioLis = this.CameraObject.GetComponent <UnityEngine.AudioListener>(); if (audioLis != null) { UnityEngine.Object.DestroyImmediate(audioLis); } audioLis = null; UnityEngine.GUILayer guilayer = this.CameraObject.GetComponent <UnityEngine.GUILayer>(); if (guilayer != null) { UnityEngine.Object.DestroyImmediate(guilayer); } guilayer = null; RideCameraController rideCamCntrl = this.CameraObject.GetComponent <RideCameraController>(); rideCamCntrl.ONGNOMCJBGE = true; if (rideCamCntrl != null) { UnityEngine.Object.DestroyImmediate(rideCamCntrl); } rideCamCntrl = null; Skybox skybox = this.CameraObject.GetComponent <Skybox>(); if (skybox != null) { UnityEngine.Object.DestroyImmediate(skybox); } skybox = null; this.cameraDestoryer = CameraDestoryer.Create(this); }
static public int get_velocityUpdateMode(IntPtr l) { UnityEngine.AudioListener o = (UnityEngine.AudioListener)checkSelf(l); pushValue(l, o.velocityUpdateMode); return(1); }
// Use this for initialization void Start() { GameSystem.GamePaused = false; //setup the camera //if we haven't been passed a rigidbody, lookup one in our children movedCurr = false; movedPrev = false; shivCurr = false; shivPrev = false; handsUpCurr = false; handsUpPrev = false; rotatedCurr = false; rotatedPrev = false; jumpCurr = false; jumpPrev = false; if (ActorCamera != null) { audioDev = ActorCamera.GetComponentInChildren<AudioListener>(); } //get info from the network if available. if (ActorCtrl.IsNetworked) { if (ActorCtrl.IsClientControlled) { networkID = Matchmaker.GetPlayerNum(); } } ReloadActor(); //add ourselves to the AI system aiManager = AIManager.GetInstance(); aiManager.AddMaster(this); //we don't want the friggin' mouse moving around! Screen.lockCursor = true; }
static AudioSource Play(AudioClip audio, float volume = 1f, float pitch = 1f, bool loop = false) { if (audio != null && volume > 0.01f) { if (mListener == null || !GameObjectUtil.GetActive(mListener)) { //全局查找AudioListener AudioListener[] listeners = GameObject.FindObjectsOfType(typeof(AudioListener)) as AudioListener[]; if (listeners != null) { for (int i = 0; i < listeners.Length; ++i) { if (GameObjectUtil.GetActive(listeners[i])) { //获取第一个AudioListener来播放音效 mListener = listeners[i]; break; } } } if (mListener == null) { //如果全局都没有AudioListener,在摄像机上添加一个 Camera cam = Camera.main; if (cam == null) cam = GameObject.FindObjectOfType(typeof(Camera)) as Camera; if (cam != null) mListener = cam.gameObject.AddComponent<AudioListener>(); } } if (mListener != null && mListener.enabled && GameObjectUtil.GetActive(mListener.gameObject)) { AudioSource source = mListener.audio; if (source == null) source = mListener.gameObject.AddComponent<AudioSource>(); source.pitch = pitch; source.loop = loop; source.volume = volume; source.clip = audio; //PlayOneShot和loop冲突,不会产生循环 source.Play(); return source; } } return null; }
/**************************************************************************************************/ /*! * \fn void Awake() * 起動時処理 * \date 2014.12.25(Thu) * \author Masayoshi.Matsuyama@Donuts */ /**************************************************************************************************/ void Awake () { isOnTimePlaying = false; if (myAudioListener == null) { // AudioListenerが設定されてないなら、このGameObjectにAudioListenerがいるかチェック myAudioListener = this.gameObject.GetComponent<AudioListener>(); if (myAudioListener == null) { // AudioListenerが居ないので追加する myAudioListener = this.gameObject.AddComponent<AudioListener>(); } DontDestroyOnLoad(this.gameObject); } #if USE_MUSICPLAYER_ONTIME_STAT Donuts.Sound.MusicPlayerOnTimeStat.Create(); #endif // USE_MUSICPLAYER_ONTIME_STAT }
private GameObject mainCamera_Init() { GameObject gomainCamera_12228 = (GetObject(12228) as GameObject); gomainCamera_12228.name = "Main Camera"; gomainCamera_12228.tag = "MainCamera"; UnityEngine.Transform commainCamera_transform_0_12234 = (GetObject(12234) as UnityEngine.Transform); commainCamera_transform_0_12234.position = new Vector3(0f, 1f, -10f); commainCamera_transform_0_12234.localPosition = new Vector3(0f, 1f, -10f); commainCamera_transform_0_12234.eulerAngles = new Vector3(0f, 0f, 0f); commainCamera_transform_0_12234.localEulerAngles = new Vector3(0f, 0f, 0f); commainCamera_transform_0_12234.right = new Vector3(1f, 0f, 0f); commainCamera_transform_0_12234.up = new Vector3(0f, 1f, 0f); commainCamera_transform_0_12234.forward = new Vector3(0f, 0f, 1f); commainCamera_transform_0_12234.rotation = new Quaternion(0f, 0f, 0f, 1f); commainCamera_transform_0_12234.localRotation = new Quaternion(0f, 0f, 0f, 1f); commainCamera_transform_0_12234.localScale = new Vector3(1f, 1f, 1f); commainCamera_transform_0_12234.parent = null; commainCamera_transform_0_12234.hasChanged = true; commainCamera_transform_0_12234.hierarchyCapacity = 1; commainCamera_transform_0_12234.tag = "MainCamera"; commainCamera_transform_0_12234.hideFlags = UnityEngine.HideFlags.None; UnityEngine.Camera commainCamera_camera_0_12232 = (GetObject(12232) as UnityEngine.Camera); commainCamera_camera_0_12232.nearClipPlane = 0.3f; commainCamera_camera_0_12232.farClipPlane = 1000f; commainCamera_camera_0_12232.fieldOfView = 60f; commainCamera_camera_0_12232.renderingPath = UnityEngine.RenderingPath.UsePlayerSettings; commainCamera_camera_0_12232.allowHDR = true; commainCamera_camera_0_12232.allowMSAA = true; commainCamera_camera_0_12232.allowDynamicResolution = false; commainCamera_camera_0_12232.forceIntoRenderTexture = false; commainCamera_camera_0_12232.orthographicSize = 5f; commainCamera_camera_0_12232.orthographic = false; commainCamera_camera_0_12232.opaqueSortMode = UnityEngine.Rendering.OpaqueSortMode.Default; commainCamera_camera_0_12232.transparencySortMode = UnityEngine.TransparencySortMode.Default; commainCamera_camera_0_12232.transparencySortAxis = new Vector3(0f, 0f, 1f); commainCamera_camera_0_12232.depth = -1f; commainCamera_camera_0_12232.aspect = 1.777778f; commainCamera_camera_0_12232.cullingMask = -1; commainCamera_camera_0_12232.eventMask = -1; commainCamera_camera_0_12232.layerCullSpherical = false; commainCamera_camera_0_12232.cameraType = UnityEngine.CameraType.Game; commainCamera_camera_0_12232.overrideSceneCullingMask = 0; commainCamera_camera_0_12232.layerCullDistances = new System.Single[] { 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f }; commainCamera_camera_0_12232.useOcclusionCulling = true; commainCamera_camera_0_12232.cullingMatrix = new Matrix4x4(new Vector4(0.9742786f, 0f, 0f, 0f), new Vector4(0f, 1.732051f, 0f, 0f), new Vector4(0f, 0f, 1.0006f, 1f), new Vector4(0f, -1.732051f, 9.405821f, 10f)); commainCamera_camera_0_12232.backgroundColor = new Color(0.1921569f, 0.3019608f, 0.4745098f, 0f); commainCamera_camera_0_12232.clearFlags = UnityEngine.CameraClearFlags.Skybox; commainCamera_camera_0_12232.depthTextureMode = UnityEngine.DepthTextureMode.None; commainCamera_camera_0_12232.clearStencilAfterLightingPass = false; commainCamera_camera_0_12232.usePhysicalProperties = false; commainCamera_camera_0_12232.sensorSize = new Vector2(36f, 24f); commainCamera_camera_0_12232.lensShift = new Vector2(0f, 0f); commainCamera_camera_0_12232.focalLength = 50f; commainCamera_camera_0_12232.gateFit = UnityEngine.Camera.GateFitMode.Horizontal; commainCamera_camera_0_12232.rect = new Rect(0f, 0f, 1f, 1f); commainCamera_camera_0_12232.pixelRect = new Rect(0f, 0f, 304f, 171f); commainCamera_camera_0_12232.targetTexture = null; commainCamera_camera_0_12232.targetDisplay = 0; commainCamera_camera_0_12232.worldToCameraMatrix = new Matrix4x4(new Vector4(1f, 0f, 0f, 0f), new Vector4(0f, 1f, 0f, 0f), new Vector4(0f, 0f, -1f, 0f), new Vector4(0f, -1f, -10f, 1f)); commainCamera_camera_0_12232.projectionMatrix = new Matrix4x4(new Vector4(0.9742786f, 0f, 0f, 0f), new Vector4(0f, 1.732051f, 0f, 0f), new Vector4(0f, 0f, -1.0006f, -1f), new Vector4(0f, 0f, -0.60018f, 0f)); commainCamera_camera_0_12232.nonJitteredProjectionMatrix = new Matrix4x4(new Vector4(0.9742786f, 0f, 0f, 0f), new Vector4(0f, 1.732051f, 0f, 0f), new Vector4(0f, 0f, -1.0006f, -1f), new Vector4(0f, 0f, -0.60018f, 0f)); commainCamera_camera_0_12232.useJitteredProjectionMatrixForTransparentRendering = true; commainCamera_camera_0_12232.scene = GetScene(); commainCamera_camera_0_12232.stereoSeparation = 0.022f; commainCamera_camera_0_12232.stereoConvergence = 10f; commainCamera_camera_0_12232.stereoTargetEye = UnityEngine.StereoTargetEyeMask.Both; commainCamera_camera_0_12232.enabled = true; commainCamera_camera_0_12232.tag = "MainCamera"; commainCamera_camera_0_12232.hideFlags = UnityEngine.HideFlags.None; UnityEngine.AudioListener commainCamera_audiolistener_0_12230 = (GetObject(12230) as UnityEngine.AudioListener); commainCamera_audiolistener_0_12230.velocityUpdateMode = UnityEngine.AudioVelocityUpdateMode.Dynamic; commainCamera_audiolistener_0_12230.enabled = true; commainCamera_audiolistener_0_12230.tag = "MainCamera"; commainCamera_audiolistener_0_12230.hideFlags = UnityEngine.HideFlags.None; return(gomainCamera_12228); }
private void Start() { #if !UltimateFPSIsPresent ACDebug.LogWarning ("'UltimateFPSIsPresent' must be listed in your Unity Player Setting's 'Scripting define symbols' for AC's UFPS integration to work."); return; #else // Assign the UFPS components, and report warnings if they are not present fpCamera = GetComponentInChildren <vp_FPCamera>(); fpController = GetComponentInChildren <vp_FPController>(); fpInput = GetComponentInChildren <vp_FPInput>(); _audioListener = GetComponentInChildren <AudioListener>(); if (fpController == null) { ACDebug.LogWarning ("Cannot find UFPS script 'vp_FPController' anywhere on '" + gameObject.name + "'."); } if (fpInput == null) { ACDebug.LogWarning ("Cannot find UFPS script 'vp_FPInput' anywhere on '" + gameObject.name + "'."); } if (fpCamera == null) { ACDebug.LogWarning ("Cannot find UFPS script 'vp_FPCamera' anywhere on '" + gameObject.name + "'."); } if (KickStarter.settingsManager != null && KickStarter.settingsManager.movementMethod != MovementMethod.FirstPerson) { ACDebug.Log ("The Ultimate FPS integration script requires the Settings Manager's 'Movement method' is set to 'First Person'"); } // Tell the AC Player component that we'l be controlling movement/rotation manually during Cutscenes player = GetComponent <Player>(); player.FirstPersonCamera = fpCamera.transform; player.SetAnimEngine (AnimationEngine.Custom); player.motionControl = MotionControl.Manual; // Assign a short delay whenever we load a saved game, to prevent firing when click if (KickStarter.saveSystem) { KickStarter.saveSystem.SetGameplayReturnTime (0.1f); } // Fixes gun sounds from not always playing AudioListener.pause = false; #endif }
public void OnAwake() { gameObject.tag = Tags.mainCamera; hideSceneWhileLoading = true; AssignOwnCamera (); if (GetComponent <AudioListener>()) { _audioListener = GetComponent <AudioListener>(); } else if (_camera != null && _camera.GetComponent <AudioListener>()) { _audioListener = _camera.GetComponent <AudioListener>(); } if (this.transform.parent && this.transform.parent.name != "_Cameras") { ACDebug.LogWarning ("Note: The MainCamera is parented to an unknown object. Be careful when moving the parent, as it may cause mis-alignment when the MainCamera is attached to a GameCamera."); } if (KickStarter.settingsManager.forceAspectRatio) { #if !UNITY_IPHONE KickStarter.settingsManager.landscapeModeOnly = false; #endif if (SetAspectRatio ()) { CreateBorderCamera (); } SetCameraRect (); } }
public static string serialize(GameObject obj) { string serialized = ""; //Message.GO_UPDATE.ToString(); serMarkerFlag serMarker = new serMarkerFlag(); //Put the marker flag info on the string first !!! serMarker.flag = obj.GetComponent <MarkerFlag>(); if (obj.transform.parent == null) { serMarker.flag.parentID = "__"; } else { serMarker.flag.parentID = obj.transform.parent.GetComponent <MarkerFlag>().id; } string flagData = new string(serMarker.toChar()); serialized += flagData; int hashLoc = genHashCode(serMarker.flag.id); int xLoc = hashLoc % 10; int yLoc = hashLoc % 100; //TODO check location if it already is there objectMap[xLoc, yLoc].Add(serMarker.flag); serialized += obj.name + "|"; serialized += obj.tag + "|"; serialized += obj.layer + "|"; serialized += obj.isStatic + "|"; Component[] comps; comps = obj.GetComponents <Component>(); for (int i = 0; i < comps.Length; i++) { if (comps[i] != null) { if (comps[i].GetType() == typeof(UnityEngine.Transform)) { UnityEngine.Transform newTransform = comps[i] as UnityEngine.Transform; Transform serNewTransform = new Transform(); serNewTransform.pos = newTransform.position; serNewTransform.rot = newTransform.rotation; serNewTransform.scale = newTransform.localScale; string transformString = new string(serNewTransform.toChar()); serialized += transformString; } else if (comps[i].GetType() == typeof(UnityEngine.BoxCollider)) { UnityEngine.BoxCollider newBoxCollider = comps[i] as UnityEngine.BoxCollider; BoxCollider serNewBoxCollider = new BoxCollider(); serNewBoxCollider.center = newBoxCollider.center; serNewBoxCollider.size = newBoxCollider.size; serNewBoxCollider.isTrigger = newBoxCollider.isTrigger; string boxColliderString = new string(serNewBoxCollider.toChar()); serialized += boxColliderString; } else if (comps[i].GetType() == typeof(UnityEngine.SphereCollider)) { UnityEngine.SphereCollider newSphereCollider = comps[i] as UnityEngine.SphereCollider; SphereCollider serNewSphereCollider = new SphereCollider(); serNewSphereCollider.center = newSphereCollider.center; serNewSphereCollider.radius = newSphereCollider.radius; serNewSphereCollider.isTrigger = newSphereCollider.isTrigger; string sphereColliderString = new string(serNewSphereCollider.toChar()); serialized += sphereColliderString; } else if (comps[i].GetType() == typeof(UnityEngine.CapsuleCollider)) { UnityEngine.CapsuleCollider newCapsuleCollider = comps[i] as UnityEngine.CapsuleCollider; CapsuleCollider serNewCapsuleCollider = new CapsuleCollider(); serNewCapsuleCollider.center = newCapsuleCollider.center; serNewCapsuleCollider.radius = newCapsuleCollider.radius; serNewCapsuleCollider.height = newCapsuleCollider.height; serNewCapsuleCollider.directionAxis = newCapsuleCollider.direction; serNewCapsuleCollider.isTrigger = newCapsuleCollider.isTrigger; string capsuleColliderString = new string(serNewCapsuleCollider.toChar()); serialized += capsuleColliderString; } else if (comps[i].GetType() == typeof(UnityEngine.Rigidbody)) { UnityEngine.Rigidbody newRigidBody = comps[i] as UnityEngine.Rigidbody; RigidBody serNewRigidBody = new RigidBody(); serNewRigidBody.mass = newRigidBody.mass; serNewRigidBody.drag = newRigidBody.drag; serNewRigidBody.angularDrag = newRigidBody.angularDrag; serNewRigidBody.interpolate = (int)newRigidBody.interpolation; serNewRigidBody.collisionDetection = newRigidBody.detectCollisions; serNewRigidBody.freeze = (int)newRigidBody.constraints; serNewRigidBody.isKinematic = newRigidBody.isKinematic; serNewRigidBody.useGravity = newRigidBody.useGravity; serNewRigidBody.collisionDetection = newRigidBody.detectCollisions; string rigidBodyString = new string(serNewRigidBody.toChar()); serialized += rigidBodyString; } else if (comps[i].GetType() == typeof(UnityEngine.Camera)) { UnityEngine.Camera newCamera = comps[i] as UnityEngine.Camera; Camera serNewCamera = new Camera(); serNewCamera.clearFlags = (int)newCamera.clearFlags; serNewCamera.background = newCamera.backgroundColor; serNewCamera.cullingMask = newCamera.cullingMask; serNewCamera.projection = newCamera.projectionMatrix.ToString(); serNewCamera.near = newCamera.nearClipPlane; serNewCamera.far = newCamera.farClipPlane; serNewCamera.viewportRect = newCamera.rect; serNewCamera.renderingPath = (int)newCamera.renderingPath; serNewCamera.HDR = newCamera.allowHDR; serNewCamera.MSAA = newCamera.allowMSAA; serNewCamera.occlusionCulling = newCamera.useOcclusionCulling; serNewCamera.depth = newCamera.depth; serNewCamera.fov = newCamera.fieldOfView; serNewCamera.targetDisplay = newCamera.targetDisplay; string cameraString = new string(serNewCamera.toChar()); serialized += cameraString; } else if (comps[i].GetType() == typeof(UnityEngine.MeshFilter)) { //Gather Meshfilter information on current GO UnityEngine.MeshFilter gOMeshFilter = comps[i] as UnityEngine.MeshFilter; Mesh gOMesh = gOMeshFilter.sharedMesh; //Pack data into our meshfilter object MeshFilter meshStruct = new MeshFilter(); meshStruct.filePath = AssetDatabase.GetAssetPath(gOMesh); meshStruct.meshName = gOMesh.name; //Convert the data into a string and add it to the overall data stream string sStream = new string(meshStruct.toChar()); serialized += sStream; } else if (comps[i].GetType() == typeof(UnityEngine.MeshRenderer)) { UnityEngine.MeshRenderer gOMeshRenderer = comps[i] as UnityEngine.MeshRenderer; //Pack data into our MeshRenderer obj MeshRenderer meshStruct = new MeshRenderer(); meshStruct.lightProbe = (int)gOMeshRenderer.lightProbeUsage; meshStruct.reflectionProbe = (int)gOMeshRenderer.reflectionProbeUsage; meshStruct.castShadows = (int)gOMeshRenderer.shadowCastingMode; meshStruct.receiveShadows = gOMeshRenderer.receiveShadows; meshStruct.motionVectors = (int)gOMeshRenderer.motionVectorGenerationMode; meshStruct.lightmapStatic = false; Material[] gOMaterials = gOMeshRenderer.sharedMaterials; for (int q = 0; q < gOMaterials.Length; ++q) { string materialPath = ""; if (gOMaterials[q] == null || gOMaterials[q].name == "Default-Material") { materialPath = "Default-Material"; } else { materialPath = AssetDatabase.GetAssetPath(gOMaterials[q]); } meshStruct.materialFiles.Add(materialPath); } string sStream = new string(meshStruct.toChar()); serialized += sStream; } else if (comps[i].GetType() == typeof(UnityEngine.Light)) { UnityEngine.Light newLight = comps[i] as UnityEngine.Light; Light serNewLight = new Light(); serNewLight.type = (int)newLight.type; serNewLight.shadows = (int)newLight.shadows; serNewLight.mode = (int)newLight.renderMode; serNewLight.cullingMask = newLight.cullingMask; serNewLight.color = newLight.color; serNewLight.intensity = newLight.intensity; serNewLight.cookie = newLight.cookieSize; string lightString = new string(serNewLight.toChar()); serialized += lightString; } else if (comps[i].GetType() == typeof(UnityEngine.GUILayer)) { UnityEngine.GUILayer newGuiLayer = comps[i] as UnityEngine.GUILayer; string lightString = "guilayer|"; serialized += lightString; } else if (comps[i].GetType() == typeof(UnityEngine.FlareLayer)) { UnityEngine.FlareLayer newGuiLayer = comps[i] as UnityEngine.FlareLayer; string lightString = "flarelayer|"; serialized += lightString; } else if (comps[i].GetType() == typeof(UnityEngine.AudioListener)) { UnityEngine.AudioListener newGuiLayer = comps[i] as UnityEngine.AudioListener; string lightString = "audiolistener|"; serialized += lightString; } } } return(serialized); }
private void Awake() { gameObject.tag = Tags.mainCamera; hideSceneWhileLoading = true; AssignOwnCamera (); if (GetComponent <AudioListener>()) { _audioListener = GetComponent <AudioListener>(); } else if (_camera != null && _camera.GetComponent <AudioListener>()) { _audioListener = _camera.GetComponent <AudioListener>(); } if (this.transform.parent && this.transform.parent.name != "_Cameras") { if (GameObject.Find ("_Cameras")) { this.transform.parent = GameObject.Find ("_Cameras").transform; } else { this.transform.parent = null; } } if (KickStarter.settingsManager.forceAspectRatio) { #if !UNITY_IPHONE KickStarter.settingsManager.landscapeModeOnly = false; #endif if (SetAspectRatio ()) { CreateBorderCamera (); } SetCameraRect (); } }
public static void componentSerialize(string ser) { GameObject gameObject = null; MarkerFlag objMarker = deserializeMarkerFlag(ref ser); int hashLoc = genHashCode(objMarker.id); int xLoc = hashLoc % 10; int yLoc = hashLoc % 100; MarkerFlag thisFlag = findInList(objMarker.id, xLoc, yLoc); if (thisFlag == null) //Make a new game object with given flag if you need to { gameObject = new GameObject(); thisFlag = gameObject.AddComponent <MarkerFlag>(); } else { gameObject = thisFlag.gameObject; } thisFlag.id = objMarker.id; thisFlag.parentID = objMarker.parentID; thisFlag.isLocked = objMarker.isLocked; if (thisFlag.parentID != "_") { int parentHash = genHashCode(thisFlag.parentID); int xParent = parentHash % 10; int yParent = parentHash % 100; MarkerFlag parentFlag = findInList(thisFlag.parentID, xParent, yParent); if (parentFlag != null) { gameObject.transform.SetParent(parentFlag.gameObject.transform); } else { gameObject.transform.SetParent(null); } } else { gameObject.transform.SetParent(null); } gameObject.name = deserializeString(ref ser); gameObject.tag = deserializeString(ref ser); gameObject.layer = deserializeInt(ref ser); gameObject.isStatic = deserializeBool(ref ser); while (ser.Length > 0) { string tag = deserializeString(ref ser); //Identifies the component type if (tag == "transform") { UnityEngine.Transform trans = gameObject.transform; trans.position = deserializeVector3(ref ser); trans.rotation = deserializeQuaternion(ref ser); trans.localScale = deserializeVector3(ref ser); if (expectedObjs > -1) { thisFlag.ogPos = trans.position; thisFlag.ogRot = trans.rotation; thisFlag.ogScale = trans.localScale; } } else if (tag == "boxCollider") { UnityEngine.BoxCollider col = gameObject.GetComponent <UnityEngine.BoxCollider>(); if (col == null) { col = gameObject.AddComponent <UnityEngine.BoxCollider>(); } col.center = deserializeVector3(ref ser); col.size = deserializeVector3(ref ser); col.isTrigger = deserializeBool(ref ser); } else if (tag == "sphereCollider") { UnityEngine.SphereCollider col = gameObject.GetComponent <UnityEngine.SphereCollider>(); if (col == null) { col = gameObject.AddComponent <UnityEngine.SphereCollider>(); } col.center = deserializeVector3(ref ser); col.radius = deserializeFloat(ref ser); col.isTrigger = deserializeBool(ref ser); } else if (tag == "capsuleCollider") { UnityEngine.CapsuleCollider col = gameObject.GetComponent <UnityEngine.CapsuleCollider>(); if (col == null) { col = gameObject.AddComponent <UnityEngine.CapsuleCollider>(); } col.center = deserializeVector3(ref ser); col.radius = deserializeFloat(ref ser); col.height = deserializeFloat(ref ser); col.direction = deserializeInt(ref ser); col.isTrigger = deserializeBool(ref ser); } else if (tag == "rigidbody") { UnityEngine.Rigidbody col = gameObject.GetComponent <UnityEngine.Rigidbody>(); if (col == null) { col = gameObject.AddComponent <UnityEngine.Rigidbody>(); } col.mass = deserializeFloat(ref ser); col.drag = deserializeFloat(ref ser); col.angularDrag = deserializeFloat(ref ser); col.interpolation = (RigidbodyInterpolation)deserializeInt(ref ser); col.constraints = (RigidbodyConstraints)deserializeInt(ref ser); col.useGravity = deserializeBool(ref ser); col.isKinematic = deserializeBool(ref ser); col.detectCollisions = deserializeBool(ref ser); } else if (tag == "camera") { UnityEngine.Camera cam = gameObject.GetComponent <UnityEngine.Camera>(); if (cam == null) { cam = gameObject.AddComponent <UnityEngine.Camera>(); } cam.clearFlags = (CameraClearFlags)deserializeInt(ref ser); cam.backgroundColor = deserializeColor(ref ser); cam.cullingMask = deserializeInt(ref ser); cam.nearClipPlane = deserializeFloat(ref ser); cam.farClipPlane = deserializeFloat(ref ser); cam.rect = deserializeRect(ref ser); cam.renderingPath = (RenderingPath)deserializeInt(ref ser); cam.allowHDR = deserializeBool(ref ser); cam.allowMSAA = deserializeBool(ref ser); cam.useOcclusionCulling = deserializeBool(ref ser); cam.depth = deserializeFloat(ref ser); cam.fieldOfView = deserializeFloat(ref ser); cam.targetDisplay = deserializeInt(ref ser); } else if (tag == "light") { UnityEngine.Light li = gameObject.GetComponent <UnityEngine.Light>(); if (li == null) { li = gameObject.AddComponent <UnityEngine.Light>(); } li.type = (LightType)deserializeInt(ref ser); li.shadows = (LightShadows)deserializeInt(ref ser); li.renderMode = (LightRenderMode)deserializeInt(ref ser); li.cullingMask = deserializeInt(ref ser); li.color = deserializeColor(ref ser); li.intensity = deserializeFloat(ref ser); li.cookieSize = deserializeFloat(ref ser); } else if (tag == "meshfilter") { UnityEngine.MeshFilter meshFilter = gameObject.GetComponent <UnityEngine.MeshFilter>(); if (meshFilter == null) { meshFilter = gameObject.AddComponent <UnityEngine.MeshFilter>(); } string filePath = deserializeString(ref ser); string meshName = deserializeString(ref ser); UnityEngine.Object[] assets = AssetDatabase.LoadAllAssetsAtPath(filePath); for (int x = 0; x < assets.Length; ++x) { if (assets[x].name == meshName) { gameObject.GetComponent <UnityEngine.MeshFilter>().mesh = assets[x] as UnityEngine.Mesh; break; } } } else if (tag == "meshRenderer") { UnityEngine.MeshRenderer gOMeshRenderer = gameObject.GetComponent <UnityEngine.MeshRenderer>(); if (gOMeshRenderer == null) { gOMeshRenderer = gameObject.AddComponent <UnityEngine.MeshRenderer>(); } gOMeshRenderer.lightProbeUsage = (UnityEngine.Rendering.LightProbeUsage)deserializeInt(ref ser); gOMeshRenderer.reflectionProbeUsage = (UnityEngine.Rendering.ReflectionProbeUsage)deserializeInt(ref ser); gOMeshRenderer.shadowCastingMode = (UnityEngine.Rendering.ShadowCastingMode)deserializeInt(ref ser); gOMeshRenderer.receiveShadows = deserializeBool(ref ser); gOMeshRenderer.motionVectorGenerationMode = (UnityEngine.MotionVectorGenerationMode)deserializeInt(ref ser); //Light map static junk deserializeBool(ref ser); string materialsList = deserializeString(ref ser); List <Material> renderMaterials = new List <Material>(); if (materialsList.Length > 1) { while (materialsList != "") { int length = materialsList.IndexOf(","); if (length > 0) { string ret = materialsList.Substring(0, length); materialsList = materialsList.Remove(0, length + 1); Material newMat = null; if (ret == "Default-Material" || ret == "" || ret == "Resources/unity_builtin_extra") { newMat = AssetDatabase.GetBuiltinExtraResource <Material>("Default-Diffuse.mat"); } else { newMat = (Material)AssetDatabase.LoadAssetAtPath(ret, typeof(Material)); } renderMaterials.Add(newMat); } } if (renderMaterials.Count > 0) { gOMeshRenderer.GetComponent <Renderer>().materials = renderMaterials.ToArray(); } } } else if (tag == "guilayer") { UnityEngine.GUILayer gOGuiLayer = gameObject.GetComponent <GUILayer>(); if (gOGuiLayer == null) { gOGuiLayer = gameObject.AddComponent <GUILayer>(); } } else if (tag == "flarelayer") { UnityEngine.FlareLayer gOFlareLayer = gameObject.GetComponent <FlareLayer>(); if (gOFlareLayer == null) { gOFlareLayer = gameObject.AddComponent <FlareLayer>(); } } else if (tag == "audiolistener") { UnityEngine.AudioListener gOAudioListener = gameObject.GetComponent <AudioListener>(); if (gOAudioListener == null) { gOAudioListener = gameObject.AddComponent <AudioListener>(); } } else { Debug.Log("Unkown Componenet Type " + tag); } } addToMap(thisFlag); }