unity游戏开发交流吧 关注:4贴子:174
  • 67回复贴,共1

【干货分享】那些我在Unity中踩过的坑。

只看楼主收藏回复

【干货分享】那些我在Unity中踩过的坑。
版权归本人所有,学习转载请注明出处,商业禁止转载
一.安装
安装其实有很大的坑,希望小白们注意一下。
首先是官网下载,下载不多说,直接说重点:
1.注册,注册有两个坑,大家注意一下,收不到验证邮件?去看看垃圾邮件里有没有,楼主因为这个连发了五六封邮件。
2.注册完以后最好把帐号密码写在记事本里,以免忘记,最重要的是不要忘记密码里有一个大写字母。
二.安装路径问题
最好是在安装时就改好,但后来再想改怎么办?别急,你只需要把Unity主程序文件夹移到你想要的位置,然后删除Hub,再安装一下hub,OK!
三.这个是把楼主害惨了的,我创建了C#脚本,然后双击,没有反应!再双击,还是没用!于是找问题,发现没有编辑器,所以打不开,于是安了vs2017。


IP属地:山东来自Android客户端1楼2020-01-16 16:06回复
    安装完我当然要试试,于是我迫不及待的打开,然后发现我没有许可证,网上也没找到,后来才发现 呃……点一下我自动激活即可,然后选则个人还是企业版。


    IP属地:山东来自Android客户端2楼2020-01-16 18:15
    回复
      还有一个未解决的,大家看看怎么回事:我在Assert Store 里安装了Standard Asserts,可是那里面的脚本都不可用,怎么办?g


      IP属地:山东来自手机贴吧3楼2020-01-17 12:21
      回复
        最近有些懒,毕竟全贴吧的帖子都是我的,全部要更,有的还没有素材,所以请大家耐心一点,OK?


        IP属地:山东来自手机贴吧4楼2020-01-23 16:52
        回复
          @咆哮的狼师 来这里发绘画贴图的截屏。


          IP属地:山东来自手机贴吧6楼2020-01-29 07:44
          收起回复
            @咆哮的狼狮 楼上


            IP属地:山东来自手机贴吧7楼2020-01-29 07:45
            收起回复
              分享一下2019版的地图纹理绘制怎么做
              2018版的如下图,点进去就行了

              2019版的打开是这样的

              这时候要先在assets面板(菜单栏)create→_→Terrain Layer,设置好地形贴图,然后到地形组件面板,paint Texture→_→Edit Terrain Layers→_→Add...把刚刚创建的地图层添加上,选择地图层,然后就能画了
              具体添加后如下图


              IP属地:山东8楼2020-01-29 10:26
              收起回复
                求助,这水的纹理什么情况?成地狱了
                我收回上午地形不卡的话(捂脸哭),现在给地形什么东西都装上后是真的卡,CPU满,内存占了6G,感觉CPU处理跟不上内存


                IP属地:山东9楼2020-01-29 19:15
                收起回复


                  IP属地:山东10楼2020-01-29 20:57
                  收起回复
                    你做amazing runner时落水重生有没有问题?随书给的完整项目打开能正常运行,我把我的项目完全对照着改了一遍,落水重生的机制还是没法正常运行,落水后不见任何反应。
                    还有重新开始游戏,它是在出生点开始,我直接在之前的目的地重生
                    在检查窗口里所有设置一模一样我真不知道哪儿有问题


                    IP属地:山东来自Android客户端11楼2020-02-01 21:48
                    收起回复
                      finishzone
                      using UnityEngine;
                      public class FinishZone : MonoBehaviour
                      {
                      //A reference to the game manager
                      public GameManager gameManager;
                      // When an object enters the finish zone, let the
                      // game manager know that the current game has ended
                      void OnTriggerEnter(Collider other)
                      {
                      gameManager.FinishedGame();
                      }
                      }


                      IP属地:山东13楼2020-02-01 22:54
                      回复
                        gamemananer
                        using UnityEngine;
                        using UnityStandardAssets.Characters.FirstPerson;
                        public class GameManager : MonoBehaviour
                        {
                        // Place holders to allow connecting to other objects
                        public Transform spawnPoint;
                        public GameObject player;
                        // Flags that control the state of the game
                        private float elapsedTime = 0;
                        private bool isRunning = false;
                        private bool isFinished = false;
                        // So that we can access the player's controller from this script
                        private FirstPersonController fpsController;
                        // Use this for initialization
                        void Start ()
                        {
                        // Finds the First Person Controller script on the Player
                        fpsController = player.GetComponent<FirstPersonController> ();
                        // Disables controls at the start.
                        fpsController.enabled = false;
                        }
                        //This resets to game back to the way it started
                        private void StartGame()
                        {
                        elapsedTime = 0;
                        isRunning = true;
                        isFinished = false;
                        // Move the player to the spawn point, and allow it to move.
                        PositionPlayer();
                        fpsController.enabled = true;
                        }
                        // Update is called once per frame
                        void Update ()
                        {
                        // Add time to the clock if the game is running
                        if (isRunning)
                        {
                        elapsedTime = elapsedTime + Time.deltaTime;
                        }
                        }
                        //Runs when the player needs to be positioned back at the spawn point
                        public void PositionPlayer()
                        {
                        player.transform.position = spawnPoint.position;
                        player.transform.rotation = spawnPoint.rotation;
                        }
                        // Runs when the player enters the finish zone
                        public void FinishedGame()
                        {
                        isRunning = false;
                        isFinished = true;
                        fpsController.enabled = false;
                        }
                        //This section creates the Graphical User Interface (GUI)
                        void OnGUI() {
                        if(!isRunning)
                        {
                        string message;
                        if(isFinished)
                        {
                        message = "Click or Press Enter to Play Again";
                        }
                        else
                        {
                        message = "Click or Press Enter to Play";
                        }
                        //Define a new rectangle for the UI on the screen
                        Rect startButton = new Rect(Screen.width/2 - 120, Screen.height/2, 240, 30);
                        if (GUI.Button(startButton, message) || Input.GetKeyDown(KeyCode.Return))
                        {
                        //start the game if the user clicks to play
                        StartGame ();
                        }
                        }
                        // If the player finished the game, show the final time
                        if(isFinished)
                        {
                        GUI.Box(new Rect(Screen.width / 2 - 65, 185, 130, 40), "Your Time Was");
                        GUI.Label(new Rect(Screen.width / 2 - 10, 200, 20, 30), ((int)elapsedTime).ToString());
                        }
                        else if(isRunning)
                        {
                        // If the game is running, show the current time
                        GUI.Box(new Rect(Screen.width / 2 - 65, Screen.height - 115, 130, 40), "Your Time Is");
                        GUI.Label(new Rect(Screen.width / 2 - 10, Screen.height - 100, 20, 30), ((int)elapsedTime).ToString());
                        }
                        }
                        }


                        IP属地:山东14楼2020-02-01 22:56
                        回复
                          PlayerRespawn
                          using UnityEngine;
                          using System.Collections;
                          public class PlayerRespawn : MonoBehaviour
                          {
                          //A reference to the game manager
                          public GameManager gameManager;
                          // Triggers when the player enters the water
                          void OnTriggerEnter(Collider other)
                          {
                          // Moves the player to the spawn point
                          gameManager.PositionPlayer();
                          }
                          }


                          IP属地:山东15楼2020-02-01 22:57
                          收起回复