Is there TryResolve in Unity?

前端 未结 6 536
独厮守ぢ
独厮守ぢ 2020-12-11 01:42

How can I make Unity not to throw ResolutionFailedException if Resolve fails?

Is there something like TryResolve<

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-11 02:00

    IComponent component= null;
    
    if (c.IsRegistered(registrationName))
    {
      component= c.Resolve(registrationName);
    }
    
    return component;
    

提交回复
热议问题