csharp 使用游戏对象上下文在GameObject上创建子容器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 使用游戏对象上下文在GameObject上创建子容器相关的知识,希望对你有一定的参考价值。

using UnityEngine;
using Zenject;

public class Ship : MonoBehaviour
{
    private ShipHealthHandler health_handler;

    [Inject]
    public void Construct(ShipHealthHandler health_handler_injection)
    {
        this.health_handler = health_handler_injection;
    }

    public void Take_damage(float damage)
    {
        this.health_handler.Take_damage(damage);
    }
}

以上是关于csharp 使用游戏对象上下文在GameObject上创建子容器的主要内容,如果未能解决你的问题,请参考以下文章