This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Two editor functions you can put wherever you like | |
public void CreateTerrainData() | |
{ | |
//get the selected terrain gameobject | |
//create a terrain asset in the folder selected in the project view | |
//name the terrain data the same as the gameobject | |
//assign the terraindata to the terrain and the terraincollider | |
var t = Selection.activeGameObject.GetComponent<Terrain>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This fixes an issue you'd encounter if... | |
1. You hit the play button with the mouse cursor. | |
2. You lock/hide the mouse cursor. | |
3. You click a mouse button (presumably right or middle mouse) to show the mouse cursor again. | |
In this case, you will find that the mouse cursor is still on the play button, and the click which unhides the cursor | |
will press the play button, thus stopping the editor. This happened to me most often when I would use a gamepad after | |
hitting play, but would want to edit something via the mouse. Not a common issue, but once you accidentally stop your |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using TMPro; | |
public class ClampDirection : MonoBehaviour | |
{ | |
public Transform targetObj; | |
public float clampAngle; |