New answers tagged

0

The Start method is only executed once at start and the NavmeshAgent won't start moving the object before the Start method finished. The moving happens between calls to Update. So check if you reached the destination in your Update method, not your Start method. I would also recommend you to use agent.remainingDistance to check if the destination is ...


1

To solve all of this problems you still have to write quite a lot of code. So this answer is just a general overview of what you need to do, not a complete implementation. When you need specific help with one of these points, feel free to ask it as a new question. When you want multiple goals, you need to change public Transform goal; into an array of ...


0

I do have some answers for you: how can I randomly move the robot asset through the house? Use a navmesh agent. (this tutorial will help you)The robot would have to set a new random target, once it reaches it's previous. This could be done by selecting a random one out of several predefined target points. Alternatively, you could attach a standart ...


1

Physics.Raycast will help you to get the gameobject using mousePosition and ScreenPointToRay using UnityEngine; using System.Collections; public class Example : MonoBehaviour { Ray ray; RaycastHit hit; void Update() { ray = Camera.main.ScreenPointToRay(Input.mousePosition); if(Physics.Raycast(ray, out hit)) ...


1

Simple method: Add two cameras to your scene, the first-person camera and the third-person camera. Attach both to the player-character. Move one on eye-height, the other further behind. Deactivate one of them. To switch between them, deactivate one and activate the other. This results in an immediate switch between the two perspectives. Fancier method: Have ...


3

You are creating a tower prefab with Instantiate (towerPrefab, transform.position, Quaternion.identity);, but you don't do anything with the GameObject it returns. The result is that your newly created tower is just an independent GameObject in your scene with no relation at all to your PlaceTower game object which created it. It seems like you want the ...


2

With your current logic you have no choice but to run into a null reference exception. You never assign anything to tower. The check canPlaceTower is only returning true if tower is null but in the code of the if statement you use tower: tower.GetComponent<TowerData>().CurrentLevel.cost;. That can't work. If you want to create a new tower instance you ...


0

There is a unity guide for general optimisation on the unity website. To summarize it quickly (read the article): Reduce texture sizes (You can have specific settings Just for IOS) Compress meshes and animation Remove any DLLs that the platform your building for doesn't use Reduce .NET API size (player Settings->IOS->Other Settings->Api Compatibility ...


1

Unfortunately - No. Unity only supports: UnityScript (JavaScript for Unity) and C#. Boo support dropped in Unity 5. But C# is very similar to Java, and I for myself started only with Java knowledge and it was no problem for me to learn C#.


0

No. As far as i know, Unity is only made to use JavaScript and C#.


0

When something bad happens while running a Java function from a Lua script, have that function exit by throwing an exception. There are several ways to implement Lua from Java, so refer to the documentation for details about how to throw an exception from a java function back to Lua. The downside is that the player will have to put lots of error checking ...



Top 50 recent answers are included