MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / CreateInstance

Method CreateInstance

Source/Editor/Scripting/TypeUtils.cs:351–367  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 15

IterateNodesCacheMethod · 0.45
IterateNodesCacheMethod · 0.45
OnLoadedMethod · 0.45
OnValuesChangedMethod · 0.45
SetMethod · 0.45
CreateMethod · 0.45
GetValueMethod · 0.45
BuildActorNodeMethod · 0.45
OnDragDropHeaderMethod · 0.45
DoAddMethod · 0.45
OnWorkspaceRebuiltMethod · 0.45
LoadMethod · 0.45

Calls 2

GetTypeFunction · 0.85
LogExceptionMethod · 0.45

Tested by

no test coverage detected