Answer by IvovdMarel
Had the same issue, restarting Unity seems to fix it for a while but it keeps on coming back... wtf?
View ArticleAnswer by IvovdMarel
Hi John, I recommend using a tween engine such as DOTween (my favourite and it's free!) or iTween. Very easy to customize and tweak through code or the inspector.
View ArticleAnswer by IvovdMarel
Besides the methods of a list starting with uppercase (Add, Remove) I see nothing wrong with this code. It should work. However, this might be a better approach: To get the surrounding objects of any...
View ArticleAnswer by IvovdMarel
Although I agree it has been answered many times - it's not always correct, so please find the correct approach here: if (GetComponent().GetCurrentAnimatorStateInfo(0).IsName(“Attack")){ print("Playing...
View ArticleAnswer by IvovdMarel
Although I am not sure if this answers your question, but if your crabs are using the same animator, but different animations, I recommend creating two crab prefabs (one for each animation setup),...
View ArticleAnswer by IvovdMarel
The public float speed is defaulted to 0, but can be set in the Unity inspector. Note: changing the value in code won't do anything, make sure you change it in the inspector!
View ArticleAnswer by IvovdMarel
I recommend not using a for-loop, but instead use InvokeRepeating. Example: int nCardsToPush = 5; void Start () { InvokeRepeating("PopCard", 0, 0.5f); } void PopCard () { if (nCardsToPush > 0) {...
View ArticleAnswer by IvovdMarel
The 'Trigger' refers to a parameter that you have create in your animator. Go to Window > Animator In the top left corner you will see both 'Layers' and 'Parameters' Click Parameters Click on the...
View ArticleAnswer by IvovdMarel
Using Dictionaries to read out JSON objects is very common but it's much easier to serialize it to a struct or class (which is also built-in to Unity using JsonUtilty.FromJson and JsonUtility.ToJson)....
View ArticleAnswer 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
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