Help:Formatting

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
m (General Guidelines)
(Improved and updated instructions)
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
==General Guidelines==
+
== General Guidelines ==
* Please spell check your additions and check punctuation and grammar to the best of your ability. The more people who do this the better the site will be.
+
 
* Please look at some similar topics to the one you would like to write for general guides on formatting if possible.  If it isn't possible, then just perform your best and we can turn this Wiki into an excellent resource.
+
* Please check for spelling, punctuation and grammatical errors in your work before submitting it. All text should also be in English.
* Discussion and comments about a page belong in the separate discussion page. The more we can use useful features like this of MediaWiki the better our site will be.  This one keeps the main page clean and the "TODO" in a concise spot.  You can visit the discussion page for any page from the link at the top of the page.
+
* 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.
*When creating linked page, use the original page as the prefix. example. Page Name, Page Name/Page1, Page Name/Page2, Page Name/Page3. This helps with indexing and search results.
+
* 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).
 
* 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).
* [http://meta.wikimedia.org/wiki/Help:Category Categories] will help this project out in the long run. Please try to use them logically and look at existing pages for use examples in our project's context.
 
 
==Creating Script Pages==
 
 
Page layouts within the Unify Community Wiki are important. By following these guidelines you help ensure wiki pages are clear and precise.
 
 
* Author = This is you the person writing the page, please include any credits to people here also.
 
* Description = A general description of what the script/code can do.
 
* Usage = How to use the script/code (please give clear precise instructions).
 
* Code = Use the code format below when writing you codes.
 
* Categories = Place the relevant category tags at the bottom of the page.
 
  
 
[[Help:Contents| More editing help.]]
 
[[Help:Contents| More editing help.]]
  
==Script Tags==
+
== Sample Code ==
=====Csharp Script Tag=====
+
  
<noinclude> <</noinclude><noinclude>csharp> </noinclude> Insert script text here<noinclude> </csharp> </noinclude>
+
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:
  
The csharp tag will produce the following example.
+
<syntaxhighlight lang="csharp">
 +
using UnityEngine;
  
<csharp>
+
public class MyScript : MonoBehaviour
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