Help:Formatting

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
m (added script tags)
(Improved and updated instructions)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Here are some typical formatting elements.  Hit the edit button above to see what you need to type to get each effect.
+
== General Guidelines ==
  
The Contents box you see below is generated automatically and responds to heading lines you add to the text:
+
* Please check for spelling, punctuation and grammatical errors in your work before submitting it. All text should also be in English.
 +
* Discussions and comments about a page belong in the accompanying discussion page. You can visit or create the discussion section of any page by clicking on the "Discussion" tab at the top left corner.
 +
* Place relevant [http://meta.wikimedia.org/wiki/Help:Category category] tags at the bottom of the page. Please try to use them logically and look at existing pages for use examples.
 +
* Look to existing pages for ideas on how to format new pages and keep content consistent but also feel free to improve upon existing formats where it makes sense.
 +
* Don't use tabs in code examples. They are hard to type when editing in a browser and lines containing tabs have weird problems when combined with links generated by the syntax highlighter. If you have a script file with tabs and don't want to change that, you can copy the contents and then run the following line in a command shell before pasting it into the wiki: '' pbpaste | expand -t 4 | pbcopy '' (This example assumes you have set your editor to have a tab stop every 4 characters).
  
= Level 1 heading =
+
[[Help:Contents| More editing help.]]
  
Don't use level one headings if you can help it.  Use level 2 headings for anything which needs a clear dividing line, and level 3 for most other things.
+
== Sample Code ==
  
== Level 2 heading ==
+
Small snippets of code, like for example <code> int health = 100</code>, can be denoted using the simple <code>&lt;code&gt;&lt;/code&gt;</code> tag but for full blocks of code and proper syntax highlighting you should use <code>&lt;syntaxhighlight lang="csharp"&gt;&lt;/syntaxhighlight&gt;</code> instead. Which will produce the following formatting:
  
=== Level 3 heading ===
+
<syntaxhighlight lang="csharp">
 +
using UnityEngine;
  
==== Level 4 heading ====
+
public class MyScript : MonoBehaviour
 
+
===== Level 5 heading =====
+
 
+
====== Level 6 heading ======
+
 
+
Use multiple single quotes for ''italics'' and '''bold''' instead of the equivalent HTML tags.
+
 
+
If you want to leave a paragraph break, use two carriage returns.
+
If you only use one, it'll automatically join the second sentence onto the first.
+
 
+
----
+
 
+
You can add a horizontal divider, like the one above,  by typing four dashes.
+
 
+
In talk pages, you can type <nowiki>--~~~~</nowiki> (two dashes and four tildes) to sign your comments with your name and a datestamp.  This makes it easier to tell who is writing.  The signature looks like this: --[[User:NCarter|NCarter]] 23:11, 28 April 2006 (GMT)
+
 
+
== Lists ==
+
 
+
You can do lists by prefixing each item with asterisks:
+
 
+
*One
+
*Two
+
*Three
+
 
+
Numbered lists are done in the same way, but with hash signs:
+
 
+
#One
+
#Two
+
#Three
+
 
+
You can nest lists by adding extra symbols, and you can even mix numbered and non-numbered lists:
+
 
+
*One
+
*Two
+
**One
+
**Two
+
**#One
+
**#Two
+
**Three
+
*Three
+
 
+
== Internal links ==
+
 
+
Don't use complete URLs for internal links.  Just use the bit which appears after 'index.php?title=' in the URL.  The following are examples of how to make various kinds of links:
+
 
+
[[Main Page]] - no need to use underscores for spaces... this is handled automatically.
+
 
+
[[Main Page|Link with a different title]] - use a bar | character to separate the link from the title.
+
 
+
[[:Category:MonoBehaviour]] - an unformatted link to a category.  For links to other namespaces, it's necessary to use a leading colon to cancel out the other colon between the namespace and the page name.
+
 
+
[[:Category:MonoBehaviour|A link to a category with a different title]] - Again, use a bar character as a separator.
+
 
+
== External links ==
+
 
+
[http://unity3d.com/ Unity] - external link.  Note that the link title is separated from the URL by a space.  You can't use a bar character for this purpose.
+
 
+
==Adding Scripts==
+
 
+
When adding scripts to your page please ensure you use the following script tags. This will help keep the wiki clean.
+
 
+
=====Csharp Script Tag=====
+
 
+
<noinclude> <</noinclude><noinclude>csharp> </noinclude> Insert script text here<noinclude> </csharp> </noinclude>
+
 
+
The csharp tag will produce the following example.
+
 
+
<csharp>
+
public class TestEvent : IEvent
+
 
{
 
{
     public TestEvent()
+
     public int value = 943;
    {
+
    }
+
  
     string IEvent.GetName()
+
     // Update is called once per frame.
 +
    private void Update()
 
     {
 
     {
         return this.GetType().ToString();
+
         if (value > 0)
    }
+
        {
 
+
            value--;
    object IEvent.GetData()
+
         }
    {
+
         return "TestEvent Data goes here!";
+
 
     }
 
     }
 
}
 
}
</csharp>
+
</syntaxhighlight>
 
+
=====Java/Unity Script Tag=====
+
 
+
<noinclude> <</noinclude><noinclude>javascript> </noinclude> Insert script text here<noinclude> </javascript> </noinclude>
+
 
+
The javascript tag will produce the following example.
+
 
+
<javascript>// CoUpdate script skeleton.
+
 
+
#pragma strict
+
 
+
function Start()
+
{
+
    StartCoroutine("CoStart");
+
}
+
 
+
function CoStart() : IEnumerator
+
{
+
    while (true)
+
        yield CoUpdate();
+
}
+
 
+
function CoUpdate() : IEnumerator
+
{
+
    // Place your update code here.
+
}</javascript>
+
 
+
=====Boo Script Tag=====
+
 
+
<noinclude> <</noinclude><noinclude>Boo> </noinclude> Insert script text here<noinclude> </Boo> </noinclude>
+
 
+
The Boo script tag will produce the following example.
+
 
+
<boo>class MessageText (Message):
+
 
+
    Text:
+
        get:
+
            return _text
+
    _text as string
+
 
+
    def constructor (text):
+
 
+
        _text = text
+
  
        # send the message
+
The <code>&lt;syntaxhighlight lang=""&gt;</code> tag also supports other programming languages like boo and javascript but the latest versions of Unity now only support C#. So using any language besides C# in the wiki is no longer recommended.
        super()</boo>
+

Latest revision as of 22:14, 23 February 2019

[edit] General Guidelines

  • Please check for spelling, punctuation and grammatical errors in your work before submitting it. All text should also be in English.
  • Discussions and comments about a page belong in the accompanying discussion page. You can visit or create the discussion section of any page by clicking on the "Discussion" tab at the top left corner.
  • Place relevant category tags at the bottom of the page. Please try to use them logically and look at existing pages for use examples.
  • Look to existing pages for ideas on how to format new pages and keep content consistent but also feel free to improve upon existing formats where it makes sense.
  • Don't use tabs in code examples. They are hard to type when editing in a browser and lines containing tabs have weird problems when combined with links generated by the syntax highlighter. If you have a script file with tabs and don't want to change that, you can copy the contents and then run the following line in a command shell before pasting it into the wiki: pbpaste | expand -t 4 | pbcopy (This example assumes you have set your editor to have a tab stop every 4 characters).

More editing help.

[edit] Sample Code

Small snippets of code, like for example int health = 100, can be denoted using the simple <code></code> tag but for full blocks of code and proper syntax highlighting you should use <syntaxhighlight lang="csharp"></syntaxhighlight> instead. Which will produce the following formatting:

using UnityEngine;
 
public class MyScript : MonoBehaviour
{
    public int value = 943;
 
    // Update is called once per frame.
    private void Update()
    {
        if (value > 0)
        {
            value--;
        }
    }
}

The <syntaxhighlight lang=""> tag also supports other programming languages like boo and javascript but the latest versions of Unity now only support C#. So using any language besides C# in the wiki is no longer recommended.

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox