Tag Info

New answers tagged


since you admittedly don't have much experience with 3D and (presumably) OpenGL, I'll give you a "bird's eye" overview of the process. I'll do my considerations about OpenGL, but the basic reasoning yields for other APIs too. When you render something with a modern version of OpenGL you create objects that will reside into the GPU memory, and then mostly ...


Add a Vector2 private variable to your class. This variable will tells you at any time where your character is facing: private Vector2 facingDirection = Vector2.zero; ... void FixedUpdate () { Vector2 movement_vector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); if (movement_vector != Vector2.zero) { ...


This is because you're editing a material. Prefabs simply reference materials, they don't contain them. That material is used for both prefabs. You can duplicate the prefabs, but make sure you create a new material for any prefabs you want to have a different material.


Passing through the gameObject name to a method, then using GameObject.Find to find it again by its name, is bad practice, and inefficient. GameObject.Find is an expensive operation. Rather do something like this... void Update () { if(Input.GetButtonDown("Fire1")){ // detect left mouse click ray = ...

Top 50 recent answers are included