Adding object to layer by layername


I want to add my instantiated GO to the GUI layer so that it gets rendered in the GUI. I’d prefer to use the name of the Layer since I don’t know if the int will be the same if someone else in the project adds a new Layer.



LayerMask.NameToLayer will return the index of the layer with the given name.