Answer by Vandarthul
Your OnTriggerEnter and OnTriggerExit callbacks don't control the Collider. Tag your Player as "Player" and do this modification : void OnTriggerEnter(Collider other) { if(other.CompareTag("Player")) {...
View ArticleAnswer by Vandarthul
shot is a GameObject, probably a public one, so you could assign it in the inspector on which gameobject you put this script on. You should put a prefab on shot variable so it can instantiate it from...
View ArticleAnswer by Vandarthul
First of all, welcome to the community and Unity. Now I'll try to explain this as much as I can. There are lots of ways to do that, but I think what you are asking is not about the situation you are...
View ArticleAnswer by Vandarthul
Good questions. - Virtual calls are always expensive than direct calls. And you should avoid having too much Update calls. It's better to have a manager class with one Update and call other classes'...
View ArticleAnswer by Vandarthul
Here is a simple script that does what you want by using both Lerp and SmoothDamp. using UnityEngine; public class SmoothDampTest : MonoBehaviour { private Transform myTransform; private Vector3...
View ArticleAnswer by Vandarthul
The code you've produced could only have two waypoints with reverse directions. I've prepared a simple kind-of-generic waypoint system which will help you produce your own. Create a two C# scripts...
View ArticleAnswer by Vandarthul
Hello, @Kirillian If you would like to create your own save/load system, it's a pretty much yes. But it should not confuse you that much, and it shouldn't be hard in this case. You just need to take...
View ArticleAnswer by Vandarthul
If I'm not wrong, you want to equalise y axis of your object to the y axis of your player. Then try using [Mathf.Lerp][1] to achieve that. [1]:...
View ArticleAnswer by Vandarthul
Try creating a gameobject array that holds every enemy in range. And check that array after you killed an enemy, if it's not 0 continue to attack, if it's 0 turn to waypoint.
View ArticleAnswer by Vandarthul
Edit - Preferences - External Tools - External Script Editor: MonoDevelop(built-in)
View ArticleAnswer by Vandarthul
declare a bool under your class and true it when the character is moving and add this code(you will have to false the bool when the character is stopped moving too): if(isOnMove) { move =...
View ArticleAnswer by Vandarthul
Lets just assume that your game's scene's name is *level1* and gameover scene's name is *gameOver*. First of all you will have to change your code to display GameOver screen as...
View ArticleAnswer by Vandarthul
I believe the problem is GetComponent returns a Type therefore it needs to be assigned to a variable. SpriteRenderer weapGunRenderer = weapGun.GetComponent(); weapGunRenderer.enabled = true;...
View ArticleAnswer by Vandarthul
private var stopWaypointLoop: boolean; function Start () { functionState = 0; stopWaypointLoo = false; } function Update () { if(stopWaypointLoop == false) { if (functionState == 0) { Accell (); } if...
View ArticleAnswer by Vandarthul
Check this: http://answers.unity3d.com/questions/31429/argumentexception-getvalue-can-only-be-called-from.html
View ArticleAnswer by Vandarthul
Okay you have two options. I'll write and advice before writing options. Instead of controlling enemy count on every enemy object, **create an EnemyController.cs** script and **add an empty gameobject...
View ArticleAnswer by Vandarthul
You can use Physics.Linecast or Raycast to control if you are touching the ground or not. You can check the unity's 2D tutorial and get the idea of using Linecast. There is a script written in that...
View ArticleAnswer by Vandarthul
Check this: https://docs.unity3d.com/Documentation/Manual/NavmeshandPathfinding.html and check sublinks also.
View ArticleAnswer by Vandarthul
transform.eulerAngles = new Vector3(transform.eulerAngles.x, 0,transform.eulerAngles.z);
View Article