Hi, I’m quite new to Unity game development and I’m sure this question has been asked before but I can’t seem to find one.
I’ve created a proof-of-concept for a game I’d like to write and I have just added UI buttons so that the game can be played on my android phone.
What I want to do now it switch the UI buttons on/off depending on whether they are needed or not.
What’s the best way to do this? I can see that there are compiler directives that can be used to identify the platform that it is running on. Are these what are normally used to tell whether virtual buttons need to be displayed ie UNITY_IOS and UNITY_ANDROID would show the buttons but UNITY_STANDALONE would not, or is there a better way such as detecting whether a keyboard is present?
I wouldn’t recommend using defines unless necessary, better use Unity - Scripting API: Application.platform, since defines hide compilation errors on platforms where define is not defined.
As you said there are various to achieve what you described above, alternatively you can leave this up to user to decide, like having few buttons in the begining (which can be both touched or clicked by mouse), where users selects control mapping.