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; | |
public class RangedExample : MonoBehaviour | |
{ | |
[Header("Numeric Attributes")] | |
[Tooltip("A float using the Range attribute")] | |
[Range(-5f, 5f)] | |
[SerializeField] | |
private float rangedFloat; |
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 class TextAreaExample : MonoBehaviour | |
{ | |
[TextArea] | |
[Tooltip("A string using the TextArea attribute")] | |
[SerializeField] | |
private string descriptionTextArea; | |
[Multiline] | |
[Tooltip("A string using the MultiLine attribute")] | |
[SerializeField] |
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; | |
[HelpURL("http://unity3d.college")] | |
[SelectionBase] | |
public class MyClass : MonoBehaviour | |
{ | |
[Header("Text Attributes")] | |
[TextArea] | |
[Tooltip("A string using the TextArea attribute")] | |
[SerializeField] |
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
[Header("Numeric Attributes")] | |
[Tooltip("A float using the Range attribute")] | |
[Range(-5f, 5f)] | |
[SerializeField] | |
private float rangedFloat; | |
[Space] | |
[Tooltip("An integer using the Range attribute")] | |
[Range(-5, 5)] | |
[SerializeField] |
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; | |
public class PoolTestingExample : MonoBehaviour | |
{ | |
[SerializeField] | |
private Projectile prefab; | |
private void OnEnable() | |
{ | |
var projectile = prefab.Get<Projectile>(); |
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 System.Collections.Generic; | |
using UnityEngine; | |
public class Pool : MonoBehaviour | |
{ | |
private static Dictionary<PooledMonobehaviour, Pool> pools = new Dictionary<PooledMonobehaviour, Pool>(); | |
private Queue<PooledMonobehaviour> objects = new Queue<PooledMonobehaviour>(); | |
private List<PooledMonobehaviour> disabledObjects = new List<PooledMonobehaviour>(); |
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 System; | |
using UnityEngine; | |
public class PooledMonobehaviour : MonoBehaviour | |
{ | |
[SerializeField] | |
private int initialPoolSize = 100; | |
public int InitialPoolSize { get { return initialPoolSize; } } |
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 System.Collections.Generic; | |
using System.Linq; | |
using UnityEditor; | |
using UnityEngine; | |
public class PoolPreparer : MonoBehaviour | |
{ | |
[SerializeField] | |
PooledMonobehaviour[] prefabs; |