Answer by IvovdMarel
Trigger checking is NOT related to FPS, as it runs in the FixedUpdate, as opposed to the Update. https://docs.unity3d.com/560/Documentation/Manual/ExecutionOrder.html FixedUpdate (and Physics) by...
View ArticleAnswer by IvovdMarel
Line 15, if (gameObject.tag == "Player") should be if (collision.gameObject.tag == "Player") You are checking if the Platform itself has the Player tag.
View ArticleAnswer by IvovdMarel
Anything that does not move in the game should be made static. The advantage of making objects static is, simply said, that Unity can run some optimizations and your game will possibly run faster. Do...
View ArticleAnswer by IvovdMarel
The issue here is that your enemies array is null. Unity would serialize the array in the inspector automatically, therefore making it not-null (but just have a length of 0). You can either initialize...
View ArticleAnswer by IvovdMarel
The render order of UI elements should (almost) never be done by z-sorting. Instead, you should change the order of the objects in your hierarchy view. The lower the object in the hierarchy, the later...
View ArticleAnswer by IvovdMarel
Is Container[0] referencing the prefab? If you don't Instantiate the object, the Start function will never run on it.
View ArticleAnswer by IvovdMarel
The easiest way to have the camera follow the position and rotation of another object is to make it a child of that object. If you really only want to follow the rotation and add an offset I would go...
View ArticleAnswer by IvovdMarel
https://unity3d.com/learn/tutorials/topics/graphics/making-transparent-shader You can just look at the source-file at the bottom but probably worth checking out the video
View ArticleAnswer by IvovdMarel
A common mistake of the 'while' loop. Anything that you put in while will infinitely repeat until the condition is no longer true. This is very different then putting something in Update, which checks...
View ArticleAnswer by IvovdMarel
You should (almost) never change the z-value of UI elements. To order, change the hierarchy in Unity. In this case, it seems like the blue background is actually part of the button. Therefore, when...
View ArticleAnswer by IvovdMarel
The Unity Manual would be the place to start: https://docs.unity3d.com/Manual/AssetBundles-Workflow.html
View ArticleAnswer by IvovdMarel
You'd have to use a variable that persists through your scene-switch. Easiest: Create a static variable e.g. public class LevelManager { public static string currentLevel = "MyFirstLevel"; } and change...
View ArticleAnswer by IvovdMarel
Vector2 rotatedDirection = Camera.main.transform.TransformVector(direction);
View ArticleAnswer by IvovdMarel
What platform are you aiming to build for? If you're exporting to Web or another AoT (ahead of time compilation) platform, this can be a struggle. If you're building a standalone build though using...
View ArticleAnswer by IvovdMarel
The null reference exception comes from either the SortedList being null or the UnitInfo component being null. Has your SortedList been initialized? UnitInfos = new SortedList(); Does every tagged...
View ArticleAnswer by IvovdMarel
I recommend using transform.InverseTransformPoint to calculate the local position of the collision. You should only have to look at the x or z value then (as the origin would be 0,0,0)
View ArticleAnswer by IvovdMarel
Yes FixedUpdate will do what you need. https://docs.unity3d.com/ScriptReference/MonoBehaviour.FixedUpdate.html https://unity3d.com/learn/tutorials/topics/scripting/update-and-fixedupdate
View ArticleAnswer by IvovdMarel
This is the old way of displaying UI and definitely not the easiest if you're trying to create a custom score-field. I recommend watching some tutorials such as:...
View ArticleAnswer by IvovdMarel
Depending on how you are modifying the y, you should look at Global: //These two lines do the exact same thing. transform.postition += new Vector3(0,5,0); transform.Translate(0,5,0, Space.World):...
View ArticleAnswer by IvovdMarel
The error will no longer pop up, and your code will compile, but it definitely does not fix the problem. You're basically telling the program to 'try' and run this code, but if there is any error you...
View ArticleAnswer by IvovdMarel
Using transform.Translate will always cause these kind of issues as it disregards the physics system. You'll have to move your object using the physics system, by accessing your Rigidbody component....
View ArticleAnswer by IvovdMarel
if (reloading) { if (currentAmmo <= 0) { if (ammoInventory >= 40) { currentAmmo += 40; ammoInventory -= 40; } else { currentAmmo += ammoInventory; ammoInventory = 0; } } }
View ArticleAnswer by IvovdMarel
Just an updated answer on this, as Unity updated their prefab system: //Get path to nearest (in case of nested) prefab from this gameObject in the scene string prefabPath =...
View ArticleAnswer by IvovdMarel
I believe you are looking for the mask component. - Add an Image component - Add a Mask component
View ArticleAnswer by IvovdMarel
1) To best find out what's causing the delays, you should use the 'Deep Profile' option. Very often you'll be surprised what's causing it (e.g. you might have something logging to the Console,...
View ArticleAnswer by IvovdMarel
I would recommend looking at a plugin like FinalIK that does exactly this.
View ArticleAnswer by IvovdMarel
As URP is completely different render pipeline, yes, it will improve performance. Obviously an empty scene is light enough to probably not notice the difference, but URP will be lighter.
View ArticleAnswer by IvovdMarel
Hey Falconstrike! On your post: I recommend in the future to provide a bit more context to your problem. You can share your own code snippets, and explain in more detail what part is not working (e.g....
View Article