一些自己的项目整理

来源:互联网 发布:优酷不能登录淘宝账号 编辑:程序博客网 时间:2024/05/22 07:42


解决方法:

Android Device Monitor ---  LogCat  ---- SavedFilters  ---   +  ----  by Log Tag   (unity)  Filter Name (随便写)

 

 

 

The profiler has run out of samples for this frame. This framewill be skipped. Increase the sample limit usingProfiler.maxNumberOfSamplesPerFrame

解决方法:

 

花屏:

 

摇杆:在3d场景中有物理检测时,人物跑动,跑跑停停,但是摇杆一直在前进状态

解决方法:ETC Joystick use Fixed Update

 

合并材质:

 

 

打包Altas报错:   Can't resize to a compressed texture format

UnityEngine.Texture2D:Resize(Int32, Int32)

Unsupported texture format - needs to be ARGB32, RGBA32,RGB24, Alpha8 or one of float formats

UnityEngine.Texture2D:SetPixels(Color[])

UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32,Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:111)

 

 

 

Agent必须在OnNavMesh的报错:

if (unit.navMeshAgent.enabled &&unit.navMeshAgent.isOnNavMesh)

                unit.navMeshAgent.Stop();

 

copy 一行数字:

TextEditor textEditor = new TextEditor ();

textEditor.content =newGUIContent (lblUID.text);

textEditor.OnFocus ();

textEditor.Copy ();

 

Failed toimport package with error: Couldn't decompress package

解决方法:路径中包含中文字符,更改成英文路径即可

 

 

分析C:\Users\[你的用户名]\AppData\Local\Unity\Editor\Editor.log当中的构建日志部分,查看打包资源列表

 

 

 

http://answers.unity3d.com/questions/13185/turn-off-shadows-for-a-specific-camera.html

 

Ihave two cameras in my scene. One is a top-down camera that is used to render a"radar" (2D) on the HUD. The other camera is the 3rd person gameplaycamera that follows the player.

Ialso have a single directional light in my scene that generates shadows. For mytop-down camera, I do not want shadows to be rendered. For the player camera Ido want shadows to be rendered.

Isthere a way to turn off shadows for a specific camera?

 

Youcan do what you describe using the Camera.OnPreRender () and Camera.OnPostRender () methods. So, you would attach a script to your minimap camerawhere, in OnPreRender, you store the current shadow distance in a classvariable usingQualitySettings.shadowDistance and set the shadow distance to 0. In OnPostRender, you simplyrestore the stored shadow distance.

var storedShadowDistance : float;

functionOnPreRender () { storedShadowDistance = QualitySettings.shadowDistance;QualitySettings.shadowDistance = 0; }

functionOnPostRender () { QualitySettings.shadowDistance = storedShadowDistance; }

 

1.  public classShadowToggler:MonoBehaviour

2.  {

3.       public Light[]SoftLights;

4.      publicLight[]HardLights;

5.       void Start()

6.      {

7.           if (gameObject.GetComponent<Camera>()==null){Debug.Log("No Camera Found");}

8.      }

9.   

10.     voidOnPreRender()

11.      {

12.         foreach(Light linSoftLights){ l.shadows=LightShadows.None;}

13.          foreach (Light linHardLights){ l.shadows=LightShadows.None;}

14.     }

15.  

16.     voidOnPostRender()

17.      {

18.         foreach(Light linSoftLights){ l.shadows=LightShadows.Soft;}

19.          foreach (Light linHardLights){ l.shadows=LightShadows.Hard;}

20.     }

21.  }

22. 

There is probably a better way than having to add yourlights to the arrays, but this is the simple method that allows for multiplelights and shadow types.

 

Frommy experiemnce, using PreCull and PostRender methods are extremely resourceintensive. There is a far easier way to do it: Just pass the Camera areplacement shader, one which doesn't render shadows (Unlit/Texture, forexample).

1.   using UnityEngine;
2.   using System.Collections;
3.   
4.   public class MapCamera : MonoBehaviour {
5.   
6.       public Shader unlitShader;
7.   
8.       void Start() {
9.           //unlitShader = Shader.Find("Unlit/Texture");
10.          GetComponent<Camera>().SetReplacementShader(unlitShader,"");
11.      }
12.  }

 

 

 

var e = myDic.GetEnumerator();

while (e.MoveNext())

{

   string typeName =e.Current.Key;

//todo something

}

 

 

子树拖拽?选中这个子树的根节点,然后按住Shift+鼠标左边

0 0
原创粉丝点击