咦~this扩展还可以这样(滑稽)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class GameObjectEx  {

    public static GameObject show(this GameObject self)
    {
        self.SetActive(true);
        return self;
    }
    public static GameObject hide(this GameObject self)
    {
        self.SetActive(false);
        return self;
    }
    public static GameObject DestroySelf(this GameObject self)
    {
        GameObject.Destroy(self);
        return self;
    }
}
发布了91 篇原创文章 · 获赞 12 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/lvcoc/article/details/88058931