Tries to create object instance of the given full typename. Searches in-build Flax Engine/Editor assemblies and game assemblies. The full name of the type. The created object or null if failed.
(string typeName)
| 349 | /// <param name="typeName">The full name of the type.</param> |
| 350 | /// <returns>The created object or null if failed.</returns> |
| 351 | public static object CreateInstance(string typeName) |
| 352 | { |
| 353 | object obj = null; |
| 354 | ScriptType type = GetType(typeName); |
| 355 | if (type && type.CanCreateInstance) |
| 356 | { |
| 357 | try |
| 358 | { |
| 359 | return obj = type.CreateInstance(); |
| 360 | } |
| 361 | catch (Exception ex) |
| 362 | { |
| 363 | Debug.LogException(ex); |
| 364 | } |
| 365 | } |
| 366 | return obj; |
| 367 | } |
| 368 | |
| 369 | /// <summary> |
| 370 | /// Creates a one-dimensional <see cref="T:System.Array" /> of the specified type and length. |
no test coverage detected