Hy, I am new using unity 3d. I have been trying to read all the documentation but I am going crazy for not finding pretty basic stuff.
Here’s what I am trying to do (a fictitious start screen):
-
I Want to draw a red rectangle with a blue border of 1 px. I want this rect to be with no round corners.
-
I want to draw inside this rect another rect with black background. inside this rectangle would be instructions on how to play the game. This rect must have a scrollable text inside it.
-
I want the user to be able to print this instructions (it’s usefull for my client). This print does not need to have any WYSIWYG, i can format the text that will be printed trough scripts.
Anyone pls help me!
The first thing I will tell you is that Unity does not possess a Print function. so you can not “print” the screen like you are thinking.
The GUI object will do most of what you need. I think the window is the part that will do the text. Look for that, and the scroll views to get the bulk of what you need done.
Now, as far as printing is concerned. As a stand alone app, or a IOS/Android app, this is out of the question, however, with a Web App, you can do printing just by faking it on a web page. Tell the browser to print when you click a button in Unity (through the browsers JavaScript) and simply use CSS to “NOT” print the Unity application. You can even go as far as to have stuff on the screen that will only print, and will not show up in the web page. Look at CSS media for that.
As far as the blocks with sizes and borders. Unity forces you to draw with a texture that is binary safe. (some derivative of the power of 2, i.e. 256x256 or 512x256) So drawing a block is not as easy as just drawing. You can get slick here though. You can make a 1x1 pixel texture and draw it 100x200, thus making it appear as if it were off size. You can do borders near the same way… 100x1 at 0,0, 200x1 at 0,0 200x1 at 100,0 and 100x1 at 0,200. There are a few other things you can do as well.
However, all that aside, if the only thing you can use to print is the Web App. Why not just make all of this part of your web page. When the game is loaded, you can have a button appear that says play. This causes the player to show and the text to hide.