User Tools

Site Tools


besiege:modding:apis

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
besiege:modding:apis [2018/06/28 14:50]
spaar
besiege:modding:apis [2018/07/07 12:02] (current)
spaar [Resources]
Line 80: Line 80:
 In addition to that, the ''​ModResource''​ class also contains the static event ''​OnResourceLoaded''​ (''​Action<​ModResource>''​). It behaves like the ''​OnLoad''​ event for a single resource but is called for all resources of a mod. It can be used to do generic error handling for example. In addition to that, the ''​ModResource''​ class also contains the static event ''​OnResourceLoaded''​ (''​Action<​ModResource>''​). It behaves like the ''​OnLoad''​ event for a single resource but is called for all resources of a mod. It can be used to do generic error handling for example.
  
 +For the most common use case, ModResources also have a ''​SetOnObject''​ method. This can be used on all resource types, except for ModAssetBundles.
 +
 +It will set the resource on the given object once it has finished loading, thereby automatically handling the case that a resource may take a longer time to load than usual.
 +
 +Additionally,​ it automatically handles the given object being instantiated as well. If the object is cloned while the resource has not finished loading, the resource will automatically also be set on all copies of the object once it has loaded.
 ===== Console ===== ===== Console =====
  
besiege/modding/apis.txt ยท Last modified: 2018/07/07 12:02 by spaar