CustomAssets
Askowl Custom Assets
GameObject.cs
1 // Copyright 2018 (C) paul@marrington.net http://www.askowl.net/unity-packages
2 
3 using Askowl;
4 using CustomAsset.Mutable;
5 using UnityEngine;
6 
7 namespace CustomAsset {
8  /// <a href="http://bit.ly/2CwSVl4">Float CustomAsset contains a float value which can be connected directly to OnValueChange callbacks in UI slider and scrollbar components. Connect it to event listeners to interact with components such as Animation, Text or Unity. Or add listeners to your own classes with Register(this)</a>
9  [CreateAssetMenu(menuName = "Custom Assets/Mutable/GameObject")]
10  public class GameObject : OfType<UnityEngine.GameObject> {
11  /// <a href="http://bit.ly/2CwSVl4">For safe(ish) access to the contents field</a>
12  public override UnityEngine.GameObject Value {
13  get => (base.Value != default) ? base.Value : NoGameObject();
14  set => Set(value);
15  }
16 
17  private UnityEngine.GameObject NoGameObject() {
18  Debug.LogError("Use menu Component/Custom Asset Game Object Connector and add this asset reference");
19  return Objects.CreateGameObject("Not assigned in Inspector");
20  }
21  }
22 }
virtual void Set(T toValue)
For safe(ish) access to the contents field
Base class for a custom asset. Provides getters and setters for the contained value and templates for...
override UnityEngine.GameObject Value
For safe(ish) access to the contents field
Definition: GameObject.cs:12