Quantcast
Channel: Answers by "IvovdMarel"
Browsing all 145 articles
Browse latest View live
↧

Answer by IvovdMarel

Using KISS principles, you could parent your Camera to another GameObject, that is placed on your floor. When you select the unit, move the parent GameObject to the selected unit. The camera offset...

View Article


Answer by IvovdMarel

You could use Unity's OnValidate method, which will run every time values have changed in the inspector. https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnValidate.html Simply check...

View Article


Answer by IvovdMarel

The best way to get around this is to use audioSource.PlayOneShot() as opposed to audioSource.Play(). Keep in mind that PlayOneShot requires an audioClip parameter, so you should make a public...

View Article

Answer by IvovdMarel

Keeping it simple: How about you create an Empty GameObject, parent the flashlight to it, and rotate it locally?

View Article

Answer by IvovdMarel

You can store the child's global rotation into a temporary variable. Quaternion childRotation = child.rotation; parent.localRotation = newParentOrientation; child.rotation = childRotation;

View Article


Answer by IvovdMarel

You are using Renderer.material.color as opposed to renderer.material.color Actually, you should use `GetComponent().material.color` Also, please keep in mind the following things: - When posting a...

View Article

Answer by IvovdMarel

You must have missed something somewhere. Environment Lighting: Intensity Multiplier should be 0 Environment Reflections: Intensity Multiplier should be 0 Make sure there are no lights in your scene If...

View Article

Answer by IvovdMarel

You should look at https://docs.unity3d.com/ScriptReference/Collider.ClosestPointOnBounds.html or just https://docs.unity3d.com/ScriptReference/Bounds.ClosestPoint.html

View Article


Answer by IvovdMarel

The error you are receiving also explains how to fix it (although I understand why it is not obvious when you read it). Consider to store it in a temporary variable: Vector3 pos = transform.position;...

View Article


Answer by IvovdMarel

You should use hit.point ( the point where it hit), not hit.distance (the distance from your object to the object that was hit). In addition, you should check the 'Use World Space' checkbox.

View Article

Answer by IvovdMarel

If your level names are the same as the text in the input-field, it's as simple as: string levelName = inputField.text; SceneManager.LoadScene(levelName); Of course don't forget to add using...

View Article

Answer by IvovdMarel

You are looking for the condition 'Has exit time' which you can find by selecting the transition arrow, above 'Settings'. Enable this, and ensure the exit time float inside 'Settings' is set to a...

View Article

Answer by IvovdMarel

Although I'm never opposed to using math, the AnimationCurve in Unity might be the better/easier/more customizable solution here. Untested code: public AnimationCurve curve; public Vector3 end; Vector3...

View Article


Answer by IvovdMarel

This code should work fine. Does your bullet actually reference the bullet object? Perhaps you are accidentally referencing a prefab. Also, you should not use Time.deltaTime in the FixedUpdate (called...

View Article

Answer by IvovdMarel

This question is still very vague, but let's see where this gets you. To store a currency, you just create an int. int currency = 0; To create multiple currencies for 2 (or more) teams, you should...

View Article


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 Article

Answer 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 Article


Answer 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 Article

Answer 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 Article

Answer 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 Article
Browsing all 145 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>