- Home /
GUI draw rectangle script not drawing rectangle!
I'm writing a 2D game on Unity's GUI layer. I attached the Boo script below to the Main Camera and gave it a texture for boardBG
, and it should just draw a rectangle. However it does not make any difference to the screen on the output if it is there or not - there is no rectangle. What am I doing wrong?
import UnityEngine
class genBoard (MonoBehaviour):
public boardBG as Texture
public cellNumX as int = 10
public cellNumY as int = 10
public cellSize as int = 20
public marginSize as int = 10
private boardWidth as int = cellNumX * cellSize + 2 * marginSize
private boardHeight as int = cellNumY * cellSize + 2 * marginSize
def onGUI ():
#Board background
GUI.DrawTexture(Rect((-boardWidth / 2), (-boardHeight / 2), boardHeight, boardWidth), boardBG, ScaleMode.ScaleToFit, true)
Answer by ExpiredIndexCard · Jun 03, 2013 at 10:14 PM
Boo huh? Switch your language. Try C# or Javascript. Nobody really uses Boo. If you want help from other people, use one of those languages. Use javascript first if you are new to programming because it is an easy language. Once you have learned that, move onto C#. I don't know any Boo so sorry to say that.
Really? That's a shame as I've got previous experience in Python. I guess I am still fairly new to program$$anonymous$$g... I'd better learn Javascript if you think it's a good idea. Any one else have an opinion on this?
totally right, if you will ask questions here, almost nobody uses boo, Its been the first question that I see in boo. But you have almost nothing to learn except a little syntax difference.
Well, if you're used to python boo is fine. Just don't expect many people here to know how to use it!
Your answer
Follow this Question
Related Questions
Where do I assign GUI scripts? 1 Answer
How to disable my Script and Gui 1 Answer
Resolutions 1 Answer
Create GUI button in update function? 3 Answers
Texture Importer 3 Answers