Quantcast
Channel: Answers by "Andrew_Kenady"
Browsing latest articles
Browse All 20 View Live

Answer by Andrew_Kenady

In general, things that are present in the Project pane independent of the scene hierarchy are persistent when in play mode. This means things like textures, materials, assets, etc. will keep your...

View Article



Answer by Andrew_Kenady

Try changing this: ---------- if (other.gameObject.tag == "Enemy") { Debug.Log("Hit! " + other.name); ---------- to this: ---------- if (other.gameObject.tag == "Enemy") { myEnemy =...

View Article

Answer by Andrew_Kenady

I assume that this script is added to the player, yes? If so, your issue lies in this part: if (col.gameObject.tag == "Enemy") { Destroy(gameObject); In this line, you've destroyed the gameobject that...

View Article

Answer by Andrew_Kenady

Odds are, you probably want to take the cursor position (Input.mousePosition) each frame, apply it to the position of your player, and then reset the mouse to the center of the screen. This is what...

View Article

Answer by Andrew_Kenady

You can add a script to the camera that simply updates the camera's position to the player's position. Something like this: public class CameraScript : MonoBehaviour { public GameObject player; private...

View Article


Answer by Andrew_Kenady

bool wasKeyADown; void Update () { if(Input.GetKey(Keycode.LeftControl) && Input.GetKey(Keycode.A) && !wasKeyADown) { //Have a party } wasKeyADown = Input.GetKey(KeyCode.A); }

View Article

Answer by Andrew_Kenady

Regardless of your script's function, you can choose Freeze Position > Y under Constraints on your player's Rigidbody component.

View Article

Answer by Andrew_Kenady

There are many ways to locate and manipulate game objects. [GameObject.Find(string name)][1] [FindObjectOfType()][2] [FindGameObjectWithTag(string tag)][3] [Transform.Find(string name)][4] and many...

View Article


Answer by Andrew_Kenady

I'm a bit confused by your question. The way I've interpreted what you've asked is "how can I preserve collision while not using a character controller or rigidbody forces?". If this is the case, all...

View Article


Answer by Andrew_Kenady

bool _pressed = false; void OnGUI () { GUI.Box(new Rect(10,10,180,80), "Debug Menu"); _pressed = GUI.Button(new Rect(20,40,160,20), "Space"); }

View Article
Browsing latest articles
Browse All 20 View Live




Latest Images