File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ public abstract class Controller {
136136 /// Check whether this controller has a service.
137137 public bool HasService <S > () where S : IService , new ();
138138 /// Gets an asset from this controller.
139- public UnityEngine. Object GetAsset (string name );
139+ public AssetType GetAsset < AssetType > (string name );
140140 /// Check whether this controller has an asset.
141141 public bool HasAsset (string name );
142142}
Original file line number Diff line number Diff line change @@ -216,10 +216,10 @@ public System.Object GetService (System.Type typeOf) {
216216 }
217217
218218 /// Gets an asset from this controller.
219- public UnityEngine . Object GetAsset ( string name ) {
219+ public AssetType GetAsset < AssetType > ( string name ) where AssetType : UnityEngine . Object {
220220 for ( var _i = 0 ; _i < this . assets . Length ; _i ++ )
221221 if ( this . assets [ _i ] . name == name )
222- return this . assets [ _i ] ;
222+ return this . assets [ _i ] as AssetType ;
223223 throw new System . Exception ( "Unable to get asset, it was not added to the controller" ) ;
224224 }
225225
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public UnityEngine.Object AddAsset (UnityEngine.Object asset) =>
5555
5656 /// Loads a asset from the controller and adds it as an asset to the entity.
5757 public UnityEngine . Object AddAsset ( string name ) =>
58- this . AddAsset ( Controller . Instance . GetAsset ( name ) ) ;
58+ this . AddAsset ( Controller . Instance . GetAsset < UnityEngine . Object > ( name ) ) ;
5959
6060 /// Sets the position of an entity.
6161 public void SetPosition ( float x , float y , float z = 0 ) =>
You can’t perform that action at this time.
0 commit comments