fixed nullable object warning
This commit is contained in:
parent
1940d01d9b
commit
72f47c297e
@ -65,7 +65,8 @@ public class GameObject
|
||||
if(Components.ContainsKey(t))
|
||||
return false;
|
||||
|
||||
Component component = (Component)Activator.CreateInstance(t, this);
|
||||
Component component = (Component?)Activator.CreateInstance(t, this)
|
||||
?? throw new Exception($"can't create instance of class {t.FullName}");
|
||||
Components.Add(t, component);
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user