Revision Difference
TypeLibrary#548095
<cat>Code.Intro</cat>⤶
<title>TypeLibrary</title>⤶
⤶
# TypeLibrary⤶
⤶
TypeLibrary is the replacement for System.Reflection - it'll only let you access types you should have access to within your game.⤶
⤶
This example should really show you everything you need to know:⤶
⤶
```csharp⤶
var entName = "BouncyBall";⤶
⤶
// Getting a type that matches the name⤶
var entityType = TypeLibrary.GetDescription<Entity>( entName )?.TargetType;⤶
if ( entityType == null )⤶
return;⤶
⤶
// Checking if that type has the SpawnableAttribute on it⤶
if ( !TypeLibrary.Has<SpawnableAttribute>( entityType ) )⤶
return;⤶
⤶
// Creating an instance of that type⤶
var ent = TypeLibrary.Create<Entity>( entityType );⤶
```⤶