ShoulO
  • Member for 7 years
  • Last seen more than a month ago
Why my Submit button not triggered once?
Accepted answer
3 votes

There are 2 ways of giving functionality to the button: 1) via code; 2) using 'OnClick' feature within 'button' component in unity 'inspector' panel; Here is the catch: You are supposed to use ONE of ...

View answer
Why does only the sound for turning off the flashlight play?
Accepted answer
2 votes

First I would suggest not to use 2 AudioSources. That causes a lot of confusion. Instead use only one audiosource for one game object, and switch between audioClips: public AudioClip clip1; public ...

View answer
How can I add a delay for each moving object?
Accepted answer
2 votes

First: are you sure that you set different value of variable delay for each object/ minion?? Because problem is here: Time.time is a number of seconds that has passed from starting the game. So it ...

View answer
Collider for Unity Line Renderer
1 votes

Yes It can be done, it requires a bit manipulation with vectors. LineRenderer has start and finish, capsule colider has height,and all features of its transform. OK lets convert LineRenderer data to ...

View answer
Finding nearby tile objects with a certain tag more easily
1 votes

Sure there is! If you have a grid you do not need a collider. By definition grid works instead of collider. What you need to do is: Store (and retrieve) each tile address into (from) data structure (...

View answer
Creating a simple countdown timer in unity
1 votes

You can also use Coroutines and InvokeReapeating. The advantage is that you can run many of them in one script and your Update function doesn't get cluttered. example with InvokeReapeating: public int ...

View answer
Parts of the FBX getting flipped upon import from Blender to Unity
1 votes

In Unity you can select all the curbs that are inverted, change scale Y value to -1, and then simply drag them down/up to the right height.

View answer
locations being stored in map manager are inaccurate and ruining overlap validation
Accepted answer
1 votes

My advice would be to store only descreet adresses of tiles and not object positions directly. Convert them into integers before storing and checking.

View answer
How to get area of grids?
1 votes

First let me rephrase your question. You are basically asking "how to know my current tile?". To do that you write Position2Tile function which takes objects position and returns tile ...

View answer
How should I make and use a method for changing the camera(transform) position and angle at run time from any script/s?
1 votes

To lift any object up or down you can simply add Vector3.up to your position: transform.position = transform.position + Vector3.up*myDistance; //if myDistance is negative it will go down // or even ...

View answer
why isnt this playing a sound?
Accepted answer
1 votes

Delete this: flashlightsound.Stop(); Also make sure you have AudioListener somewhere (usually attached to camera). And make sure AudioSource component is added to the gameobject AND you have access ...

View answer
add force to object that has 2 different rigid bodies
1 votes

EDITED In Unity you have 2 ways of moving objects - either 'manually' move it little by little, or let Unity physics move it for you - add rigidbody, and give rigidbody force or velocity. Both ...

View answer
Calculating new Velocities of split Physics Body
1 votes

I intended this as a comment, but got too long. In real world angular velocity 'kinda does not exist' as such. Spinning is linear speed which is constantly changing. Lets take scenario of ball ...

View answer
Why the distance from the missionTarget is never less then 0.15?
1 votes

your code needs cleaning a bit. here is your problem: Within function Move you are telling object to move to position stopPoint not to missionTarget.position. That's what object does, - it arrives to ...

View answer
How can I change the objects speed movement at run time but only once each time?
Accepted answer
1 votes

In your case only use Update() for 2 things: To check if way point already is reached; If not yet, move gameobject small incremental distance; Other parameters of gameobject, - ,such as speed, ...

View answer
How to trigger OnMouseX events on Kinematic Rigidbody2D object with a different collider than one used for collisions?
1 votes

My 3d game objects often would have multiple colliders - one on the parent for selecting/clicking, and others on children for such things as vision (detecting enemies), for detecting range, etc. For ...

View answer
How to get light level (brightness) of a particular location?
Accepted answer
1 votes

Sorry I am not bringing "graphical" solution. But as you said every suggestion is welcome. So this should work also: A script which is run on each torch, not each tile. Your torch reach is 5 ...

View answer
Gameobject doesn't move when hits wall
0 votes

Also you can avoid using walls altogether. Just keep track on which tile you are on , and if you reached outer tile, just don't move anymore. Lets say your starting point is bottom, right corner (0,0)....

View answer
Gameobject doesn't move when hits wall
0 votes

Seems that the problem that wall stops you arriving to nextPosition so distance to it is always slightly above 0.0005f. Am I correct? If yes, your nextPosition is not reset even if you press the ...

View answer
Filing a dictionary through an enumerator 1 listing at a time
0 votes

To answer your question about Dictionary - you can use dictionary like this: Dictionary<int,Sprite> niceDictionary = new Dictionary<int, Sprite>(); ... niceDictionary.Add(4654, ...

View answer
Is there a way to create animation from array of 2d sprites in runtime that works in build in Unity
Accepted answer
0 votes

why not just use coroutine: IEnumerator doAnimation() { for (int i = 0; i < spritearray.Length; i++) { yield return new WaitForSeconds(0.03F); myImage.sprite = spritearray[i]...

View answer
How can I move an object the fastest way?
Accepted answer
0 votes

Yes, Vector3.MoveTowards can be used. All it does - it moves object a bit. The bigger this 'bit' the further it moves. if you put it in Update() function it will move your object every frame by 'a bit'...

View answer
Stop 2D platformer character from sliding down slope
0 votes

Unity here is constantly running physics simulation (trying to mimic the actual world a bit) and thus applies various forces to your rigidbody2d depending on situation. If rigidbody is on the slope ...

View answer
Placing a circle as close as possible to a specific coordinate without overlapping another circle
0 votes

While making games I face similar problems quite often. What I found is that often best (quickest,easiest) way is.. not to look for that perfect answer, instead use computer to work it out for me. ...

View answer
Rigidbody not working properly
0 votes

As I explained here there are 2 ways of moving objects: To change transform position by little bit every frame; To use inbuilt physics, and give rigidbody velocity,(or force). You chose method 1, ...

View answer
Why the MoveTowards make the transform moving nonstop?
0 votes

Just make sure your exitPosition is set only once: private void OnTriggerExit(Collider other) { if (other.name == "Cube" && exited == false) { Debug.Log("Exited !...

View answer
How can I make all the objects to move between the waypoints?
0 votes

In my opinion best thing to do is: To make one movement script and to attach it to each object, so that each object can run its own movement script separately. Then just fire moving command to each ...

View answer
How to make an object covers a specific distance before moving in other direction for same distance?
Accepted answer
0 votes

There are two ways to do it: To move object little by little every frame. I use this method to move units in my RTS game. In order to stop at wanted point I check every frame the distance left to ...

View answer