I have been stuck on a rather trivial circumstance that is etching into my brain. So I am rather new to unity programming but I have been programming in both C# and Java for two - three years. I feel rather stupid for asking this but I can’t seem to find an answer
So I am not sure what the main coding convention with unity is whether you should centralize code to avoid duplication or have a script across several components that is duplicated (obviously seems incorrect).
At the moment I have 8 guiTextures that make up a players navigation. Instead of creating a script for each individual guiTexture I want a centralized script that is an empty game object that holds the script. This script will check which one is being clicked and act accordingly. I have tried function OnMouseUp(), Raycasting. I just can’t find a solid conclusion.
On another note, for one of my others scripts I have if(hit.collider.tag == “fence”) else if … and there are 27 of these. Is there an easier way of executing this, I know python has a dictionary function that allows a reference to variable format, although I am not familiar with boo.