Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is Right Way to Add Joystick in Unity3d , Adding on Scene Directly or Iniatiating it From Player Scripts

I have to add Joystick control in my Game I had done with Two Approaches both works well for me , but confused Which one to go with.

1) Initiating Joystick Control from Players Object/Script and getting inputs there. 2) Add Joystick Control Directly to Game Scene and then accessing it in player script by findObjectwithTag and getting inputs .

like image 437
deepakPatilCuelogic Avatar asked Oct 20 '22 13:10

deepakPatilCuelogic


1 Answers

Calling "Instantiate" and "GameObject.Find" is pretty expensive so in my opinion the efficient way is

1: Add Joystick Control Directly to Game Scene

2: Create a public object inside player and assign "joystick control" from inspector (Editor).

like image 104
Hamdullah shah Avatar answered Jan 02 '23 19:01

Hamdullah shah