Customisable Text area

I am wanted to create a customisable text box, similar to what you would find in Powerpoint, so that a user can enter text into it and move/resize it within the bounds of the object that it is attached to. Does anyone have any tips or suggestions on how to go about this?

Edit: Have spent the afternoon looking at Text Meshes to discover you can’t resize them using code, so that’s a no no, unless I come up with several font sizes instead.

You can use a text area to enter the text, but there is no built in system for letting the user resize and reposition the box. The GUI.TextArea function takes a rectangle as a parameter, so you can certainly change the size and position from the code as necessary. It will most likely come down to getting the mouse position (with Input.mousePosition and detecting when the button is down (with Input.GetMouseButtonDown. Determining what action to take in response to the input will depend on exactly what type of interaction the user will have (eg, handles in the corners or edges and different modes for dragging and text entry). I suspect there will be quite a lot of work involved in getting this just the way you want it :wink:

Yeah, the GUI.TextArea is not going to be of any use to me on this either, as it is GUI, it’s position is based on screen space, whereas my text is to be placed on an object in world. Think of a school blackboard in a room where people can go up and write on it, only with the added features of being able to move or resize it on the board. What we have currently allows us to input text which we store and draw the characters in the string using a font file, and while this allows us to be able to move it about, we can’t get in and edit the text as there is no cursor. Looks like I may have to implement a cursor, using the OnMouseDown to detect moving the “cursor”, displaying it somehow, and using substrings to edit the whole string.