Answer by IvovdMarel
'Highlighting' is a pretty vague term, but if you'd like to instantiate something like a particle system where you clicked (or a light, anything really) you'll need to use Raycast. RaycastHit hit; if...
View ArticleAnswer by IvovdMarel
Yes, it is possible to do bone animation and position / scale tweens through the Unity Animation window. However, compared to Flash, this is definitely quite limited. There are a few plugins that make...
View ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer by IvovdMarel
Keeping it simple: How about you create an Empty GameObject, parent the flashlight to it, and rotate it locally?
View ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer by IvovdMarel
If you want to make it stop when it's close to the target, you can use Vector3.Distance (and check if it's smaller than a certain amount). If you call AddForce every frame, more and more force will be...
View ArticleAnswer by IvovdMarel
I'm assuming the object with the tag "Enemy" have a component EnemyHealth. If that's the case, you want to access that particular enemy and it's component. Rather than calling enemyHealth (which is a...
View ArticleAnswer by IvovdMarel
Old question but I bumped into this and felt the need to answer. Most likely your canvas is set to Pixel Perfect. Disable this and your performance could quadruple (that's what happened to me)
View ArticleAnswer by IvovdMarel
Replace the OnTriggerStay method with: void OnTriggerEnter2D(Collider2D coll){ if (gameObject.tag == "squarerow"){ triggered = true; } } void OnTriggerExit2D(Collider2D coll){ if (gameObject.tag ==...
View ArticleAnswer by IvovdMarel
Rather than continuously checking wether or not you are touching the object, you should set a boolean to true, similar to this: if (Input.GetMouseButtonDown(0)) { if(Physics.Raycast(ray,...
View ArticleAnswer by IvovdMarel
You can in the update multiply the alpha of the particle effects by your totalAlpha property which starts at 1 and slowly goes down to 0.
View ArticleAnswer by IvovdMarel
uGUI works with a 'parent controls child' attitude, not the other way around. Therefore, the thing that you want (child controls parent) is a bit of extra work. First, add a VerticalLayoutGroup or...
View ArticleAnswer by IvovdMarel
Ways to move your buttons: - Mecanim. Unity allows you to use their mecanim animation system for your UI. - Code. You can use a method such as Vector3.Lerp to gradually move your object from point A to...
View Article