This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.SceneManagement; | |
[CustomEditor(typeof(Prueba))] | |
public class PruebaEditor : Editor { | |
Prueba Target { get => (Prueba) target; } | |
void OnSceneGUI () { | |
Ray rayo = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class Practice : MonoBehaviour { | |
public float radius = 3; | |
public GameObject prototype; | |
public List<GameObject> r; | |
public List<GameObject> Search () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string ToggleGroup (string current, string[] options) { | |
foreach (string option in options) { | |
if (GUILayout.Toggle(current == option, option, "Button")) { | |
current = option; | |
} | |
} | |
return current; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IMage { | |
public Mage Mage { get; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class ThingCreator : MonoBehaviour { | |
public GameObject prototype; | |
public Transform positionIndicator; | |
void Update () { | |
if (Input.GetKeyDown(KeyCode.Space)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static GameObject SafePrefabInstantiate(GameObject reference){ | |
return SafePrefabInstantiate(reference,Vector3.zero,Quaternion.identity); | |
} | |
public static GameObject SafePrefabInstantiate (GameObject reference, | |
Vector3 position, | |
Quaternion rotation) { | |
#if UNITY_EDITOR | |
if (Application.isPlaying) { | |
return GameObject.Instantiate(reference, position, rotation); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RaycastHit hitInfo; | |
Ray worldRay = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition); | |
return Physics.Raycast(worldRay, out hitInfo); | |
if (Event.current.type == EventType.MouseDown) { | |
// el usuario hizo click en la escena! | |
GUIUtility.hotControl = GUIUtility.GetControlID(FocusType.Passive); | |
Event.current.Use(); | |
// las dos líneas de código anteriores cancelan el evento. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.Playables; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class CinematicController : MonoBehaviour { | |
public PlayableDirector director; | |
public bool IsPaused { get => director.state == PlayState.Paused; } | |
public GameObject[] controlables; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class BallVictoryTriggerer : MonoBehaviour { | |
void OnEnable () { | |
} | |
void OnDisable () { | |
GameManager.OnGameEndingTriggered -= Asdf; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.SceneManagement; | |
[CustomEditor(typeof(asdf))] | |
public class AsdfEditor : Editor { | |
asdf Target { get => (asdf) target; } | |
// https://docs.unity3d.com/ScriptReference/EditorGUILayout.html | |
// https://docs.unity3d.com/ScriptReference/GUILayout.html |