addcomponent_AddComponent(string):Unity 5.0中的API删除

addcomponent_AddComponent(string):Unity 5.0中的API删除_第1张图片

addcomponent

GameObject::AddComponent(string) has been removed in Unity 5.0.  The alternatives are two overloads of this API, one taking the component type as a generic type argument and another one taking a reference to the component type. Automatic API updating has been configured but not all cases can be handled automatically.

GameObject :: AddComponent(string) 已在Unity 5.0中删除。 备选方案是此API的两个重载,一个重载了组件类型作为泛型类型参数,另一个重载了对组件类型的引用。 已配置自动API更新,但并非所有情况都可以自动处理。

In our quest to improve Unity we realized that we should let GameObject::AddComponent(string) go; in our first attempt we were too “aggressive” and removed GetComponent(string) as well. However, after receiving some great feedback, we reevaluated this decision and reintroduced it.

在寻求改进Unity的过程中,我们意识到应该放开GameObject :: AddComponent(string) ; 在我们的第一次尝试中,我们过于“激进”,并删除了GetComponent(string) 。 但是,在收到一些好评后,我们重新评估了该决定并重新提出。

Unfortunately we could not do the same with AddComponent(string) (it would reintroduce the very same dependencies we are aiming to break, i.e, from core to subsystems). If your project uses this method you have two possible alternatives (depending on the accessibility of the type as explained in the rules related to compilation order and how the type name is specified). We’ll further describe these options in the following paragraphs (examples are written in C# but the same concepts applies to UnityScript (js) / Boo).

不幸的是,我们不能对AddComponent(string)做同样的事情(它将重新引入我们要打破的完全相同的依赖关系,即从核心到子系统)。 如果您的项目使用此方法,则有两种可能的选择(取决于

你可能感兴趣的:(python,java,linux,c++,编程语言)