Answer by ransomink
You can distinguish between multiple components by using GetComponents. HingeJoint[] hingeJoints; void Awake() { hingeJoints = GetComponents(); } They will be placed in order from top-to-bottom. If the...
View ArticleAnswer by ransomink
Don't use SendMessage() or BroadcastMessage(), they are extremely slow and very painful to debug because you pass in a string. They are seldom used for quick prototyping to get something up and running...
View ArticleAnswer by ransomink
Is this in the bullet script? Make sure both the player and bullet have the Player tag. Also, use CompareTag() instead... void OnTriggerEnter2D( Collider2D other ) { // Not the player? if (...
View ArticleAnswer by ransomink
Why use *transform.gameObject* for DontDestroyOnLoad(), then use *gameObject* for Destroy(), no need for using transform. Also, you call Input.GetAxisRaw() 14 times in Update(), that's bad. You need to...
View ArticleAnswer by ransomink
Now, you can simply click & drag a component to change its order...
View ArticleAnswer by ransomink
You're trying to divide a WaitForSeconds type by an integer type. You must divide by an int or possibly a float value...
View ArticleAnswer by ransomink
What line is the actual error on because this isn't where the problem lies. WaitForAnim takes 1 argument (anim) but you've used it—somewhere—without placing an anim parameter. - WaitForAnim takes 0...
View ArticleAnswer by ransomink
In Edit > Project Settings > Physics, use the Layer Collision Matrix and choose what layers to ignore each other...
View ArticleAnswer by ransomink
The first problem I see is setting up your variables. You create float variables, then cast them as floats, that's unnecessary. You were likely getting an error because you left out the "f" after each...
View ArticleAnswer by ransomink
using System.Collections; using System.Collections.Generic; using UnityEngine; public class EnemySkullMovement : MonoBehaviour { public float speed; private float distance; private float step; private...
View ArticleAnswer by ransomink
Did you test and see if it works? There's nothing wrong with it. No reason to create a variable only to return it on the next line...
View ArticleAnswer by ransomink
No problem, you'll want to check the player's previous position against their current position. If the distance is the same or minimal (using a tolerance), they're not moving. When the player moves,...
View ArticleAnswer by ransomink
On which line is the null reference exception? That'll tell us what variable to look for. It seems *resetCol* could be null because you say the array is empty. This is because *resetCol* must have the...
View ArticleAnswer by ransomink
You can import your sprite as 2D and UI, then place it on a canvas as a UI Image and use it with the button component...
View ArticleAnswer by ransomink
I think it could be a bit simpler. I wouldn't have so many operands at once because if one condition is not true, you won't have to check the others. A simple way to measure time, you can do: public...
View ArticleAnswer by ransomink
Just go to the Unity [Learn][1] section. There is an abundance of tutorials. Everything is there for you. Learn and have fun... [1]: https://unity3d.com/learn
View ArticleAnswer by ransomink
Vector3Int was implemented in Unity 2017.2.0 as you've stated. You are using an older version, Unity 5.6.5. That is why it does not exist. As Bunny83 mentioned, there are many versions after 5.6.5. If...
View ArticleAnswer by ransomink
GetComponents() will get all audio source components on the game object attached to this script. If there is only one audio source then it will only have one in the array. They will enter the array in...
View ArticleAnswer by ransomink
Did you download it from here: [2D Roguelike][1]. I believe It informs you of any changes from the updated version... [1]: https://unity3d.com/learn/tutorials/s/2d-roguelike-tutorial
View ArticleAnswer by ransomink
First, make sure the enemy has the "Enemy" tag. Also, A Kinematic Rigidbody 2d cannot collide with another; at least one of the rigidbodies must be set to Dynamic. Since your sword is Kinematic, your...
View Article