#1 Posted by TyCobb (1945 posts) -

Hopefully this is the correct forum to ask this. If not, please move it to the appropriate forum.

In the new redesign, I'd like to see the parchment have an actual code block. The Code button now is just for seeing the HTML, but I want to see an actual code block where the font is forced to some sort of monospace font and spaces aren't trimmed. I think we have enough users that are doing some sort of programming that this could be warranted. I am not asking for anything major like syntax highlighting and registering what kind of language you wrote. I am just asking for some block that allows us to have a monospace font like Courier and to keep the format that we typed.

I hope that makes sense and is somewhat of possibility.

Thanks.

#2 Edited by Salarn (463 posts) -

@TyCobb: This would be great to have.

I find that it's a real hassle to try and paste code onto the forums.

Everything is just trashed when you try to post a code segment.

----------------

// Awake happens once on object initiation

void Awake()

{

// We need to build our sprite, which starts with a simple mesh

MeshFilter pMeshFilter = (MeshFilter)gameObject.GetComponent(typeof(MeshFilter));

m_pMesh = pMeshFilter.mesh = new Mesh();

m_pMesh.vertices = new Vector3[] { new Vector3(-1.0f, -1.0f, 0.0f), // This is creation a square 2D mesh

new Vector3(1.0f, -1.0f, 0.0f), // We are just filling in generic

new Vector3(-1.0f, 1.0f, 0.0f), // data here making a 2x2 pixel

new Vector3(1.0f, 1.0f, 0.0f) }; // square

m_pMesh.triangles = new int[] { 0, 2, 1, 3, 1, 2 }; // This is our triangle list

// To make a square it takes 2 triangles

// Depending on the order the facing of

// the triangles will change.

m_pMesh.uv = new Vector2[] { new Vector2(0.0f, 0.0f), // We finally strech our texture

new Vector2(0.0f, 1.0f), // accross the mesh, default values

new Vector2(1.0f, 0.0f), // again are being used here.

new Vector2(1.0f, 1.0f) };

m_pMesh.RecalculateNormals();

MeshRenderer pMeshRenderer = (MeshRenderer)gameObject.GetComponent(typeof(MeshRenderer));

pMeshRenderer.material = (Material)AssetDatabase.LoadAssetAtPath("Assets/Materials/Checker.mat", typeof(Material));

m_pTexture = pMeshRenderer.sharedMaterial.mainTexture;

m_vTextureCoords[2] = m_pTexture.width;

m_vTextureCoords[3] = m_pTexture.height;

InitGraphics();

pMeshFilter.hideFlags = HideFlags.HideInInspector;

pMeshRenderer.hideFlags = HideFlags.HideInInspector;

m_pTexture.hideFlags = HideFlags.HideInInspector;

}

#3 Posted by Rxanadu (504 posts) -

I third the implementation of a proper Code block function. For those who want to help each other out in programming (myself included), it'd be such a load off our shoulders to be able to present the information without taking up a page for only 50 lines of code in a generic text editor. Speaking of small bit of code looking bad in this comment system: Why do you have an Awake() function from Unity code in your comment? If it's to make the same point I'm talking about, it makes it well.

#4 Posted by Aegon (5401 posts) -

That would be cool.

#5 Posted by Salarn (463 posts) -

@Rxanadu: The Awake function is unique, I have a comment stating why. It's a 'Do this on creation' thing.

Again, not being a jerk, but look at the code it's reasonably well commented. Why do you think I'm using the Awake() function?

-------------

back to the topic on hand, a [code] tag would be great

#6 Posted by KamasamaK (2408 posts) -

@Salarn said:

back to the topic on hand, a [code] tag would be great

I don't know if adding a BBCode-style tag is a good solution. There is already an HTML <code> tag that they could make work properly.

#7 Posted by Salarn (463 posts) -

@KamasamaK: In concept more than implementation ;)