Skip to content

Hard references to prefabs are converted to weak references at build time

License

Notifications You must be signed in to change notification settings

nostek/UnityWeakReferences

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 

Repository files navigation

UnityWeakReferences

Hard references to prefabs are converted to weak references at build time.

Installation

Copy the UnityWeakReference folder in to your project. Use WeakPrefab/WeakSprite/WeakTexture2D/WeakAudioClip in your MonoBehaviour/Array/List/Custom Class and fill out the field in the editor. All set!

Example

public WeakPrefab MyPrefab;

void Start() { Instantiate(MyPrefab.Prefab); }

Supported types

  • Prefab/GameObject
  • Sprite
  • Texture2D
  • AudioClip

Known issues

  • If used in a script in the project view, the referenced object will be added to the build even if the reference holder is not.
  • To speed up the processing it looks MaxDepth layers down. The lower the faster, but deeper nesting needs higher. Default is 5.

About

Hard references to prefabs are converted to weak references at build time

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages