• Manual
  • Scripting API
Show / Hide Table of Contents
  • Introduction
  • How To Install
  • Runtime Objects
    • Creating Runtime Objects
    • Runtime Object Properties
  • Events
    • Event Objects
    • Event Listeners
    • Hello World Example
  • Runtime Items
    • Value Items
    • Reference Items
  • Runtime Lists
    • Value Lists
    • Reference Lists
  • Populators
  • State Machines
    • Using State Machines
    • State Machine Controllers
    • Using State Machine Controllers
  • Versioning Your Apps
  • Modular Scene Loading
  • Attributes
  • License
  • Advanced Topics
    • Settings
    • Why The Resources Folder?
    • Strings as Value Types?
    • Extending The Framework

Reference Lists

ReferenceLists are a kind of RuntimeList that are designed to handle reference types like strings and GameObjects. Below is an example of a GameObjectList which can be created via "Create > Runtime Objects > Reference > List > GameObjects". All ReferenceLists have an items property which actually contains the references in question.

Figure2

There are some limitations with ReferenceLists. It's mainly due to the fact that, in Unity, scene objects can maintain references to assets outside of play mode, but assets cannot maintain references to scene objects outside of play mode. So unless your ReferenceList is storing a reference to another asset like a prefab, it will not be possible for it to go into play mode with a reference already set. This means you'll need to set the reference yourself during runtime.

However, you can also use these objects to store direct references to other assets instead of referencing objects in your scene during runtime. To do this, simply drag in your asset references and be sure to check the forAssetReferencingOnly box so that this RuntimeObject will ignore all calls for clearing and resetting its data. This will ensure that your references persist both in and out of playmode.

This feature is especially useful for referencing prefabs that you need to access in many parts of your code. Naturally, you won't need to use any populators when using these objects in this way.

  • Improve this Doc
Back to top Generated by DocFX