B
B
bslovegood2021-01-26 10:56:51
Unity
bslovegood, 2021-01-26 10:56:51

How to give speed to GameObject through InputField?

Unity, there is an object in the scene, a sphere, and it has a script in which it is given a force in the X direction, and when it starts, it moves. But I need to create an element, so I added it to the models folder and ran it through the script, (Instantiate(element, new Vector3(x0, y, z), Quaternion.identity);) and attached it to the button. and when the element appears, it moves(rigidbody.AddForce(Force, 0, 0, ForceMode.Impulse);). Everything works, but there was a need to set Force through InputField; If the element is in the scene, then I can attach the inputfield, but if it is not on the stage, and I do it to the model, then it stupidly does not accept it. Who knows why he does this? and how can i get around this

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2021-01-26
@freeExec

  1. Created an object
  2. Assigned it inputField

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question