cyberfrogg Asked:2020-02-15 05:19:02 +0000 UTC2020-02-15 05:19:02 +0000 UTC 2020-02-15 05:19:02 +0000 UTC 如何按名称添加组件? 772 有一个对象spawnedObject。我想这样做,以便按其类型添加组件。例如: string a = "Rigidbody"; spawnedObject.AddComponent<a>(); 还是团结超越了它的力量? c# 1 个回答 Voted Best Answer user302909 2020-02-15T06:17:31Z2020-02-15T06:17:31Z string type = "Rigidbody"; spawnedObject.AddComponent(Type.GetType(type));
1 个回答