Herramientas de usuario

Herramientas del sitio


fw:unity3d:environtment2d

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anterior Revisión previa
Próxima revisión
Revisión previa
fw:unity3d:environtment2d [2014/04/24 13:30]
alfred [Basic]
fw:unity3d:environtment2d [2020/05/09 09:25] (actual)
Línea 26: Línea 26:
   * ''​OnDisable()''​   * ''​OnDisable()''​
   * ''​OnGUI()''​   * ''​OnGUI()''​
 +
 +Properties
 +  * ''​transform'',​ contains the methods and objects to move the object.
  
 === Interact with objects === === Interact with objects ===
Línea 36: Línea 39:
   * ''​Destroy(gameObject,​ time)'',​ will destroy an instatiated prefab on 20secs.   * ''​Destroy(gameObject,​ time)'',​ will destroy an instatiated prefab on 20secs.
   * ''​Destroy(gameObject)'',​ destroys the object now.   * ''​Destroy(gameObject)'',​ destroys the object now.
 +  * ''​SendMessage'',​ calls a method on each script which have it inside the GameObject.
 +<code csharp>
 +// Calls the function ApplyDamage with a value of 5
 +gameObject.SendMessage ("​ApplyDamage",​ 5.0);
 +...
 +// Every script attached to the game object ​
 +// that has an ApplyDamage function will be called.
 +function ApplyDamage (damage : float) {...
 +</​code>​
  
   * Propiedades:​   * Propiedades:​
Línea 69: Línea 81:
   * ''​Debug.Log()'',​ shows a message in console.   * ''​Debug.Log()'',​ shows a message in console.
   * ''​Debug.Break()'',​ stops the game.   * ''​Debug.Break()'',​ stops the game.
 +
 +=== Camera ===
 +The static object ''​Camera.main''​ contains the main camera for the scene.
 +  * ''​ViewportToWorldPoint''​ and ''​WorldToViewportPoint''​ to transform coordinates.
  
 === Useful functions === === Useful functions ===
Línea 273: Línea 289:
 <code csharp> <code csharp>
 if (GUI.Button()) { if (GUI.Button()) {
 +</​code>​
 +To make a property which won't be shown in the editor:
 +<code csharp>
 +[HideInInspector]
 +public float mAngle = 0f;
 +</​code>​
 +To create a option menu you will add a class of the next style:
 +<code csharp>
 +using UnityEngine;​
 +using UnityEditor;​
 +using System.Collections;​
 +
 +public class FunWindow : EditorWindow
 +{
 + [MenuItem("​Tools/​Fun Window"​)]
 + public static void ShowWindow()
 + {
 + EditorWindow.GetWindow<​FunWindow>​("​Fun Window"​);​
 + }
 +
 + void OnGUI()
 + {
 + if(GUILayout.Button("​Clear PlayerPrefs"​))
 + {
 + PreferencesManager.DeleteAll();​
 + }
 +
 + if(GUILayout.Button("​Clear Store"​))
 + {
 + Unibiller.clearTransactions();​
 + }
 + }
 +}
 </​code>​ </​code>​
 ==== Coroutines ==== ==== Coroutines ====
fw/unity3d/environtment2d.1398346250.txt.gz · Última modificación: 2020/05/09 09:24 (editor externo)