npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

io.nekonya.tinax.xcomponent

v6.6.4

Published

Remove Component from dependency on MonoBehaviour class

Downloads

117

Readme

TinaX Framework - X Component.

LICENSE LICENSE

让Unity Component脱离对MonoBehaviour的直接依赖。

Remove Unity Component from its direct dependency on MonoBehaviour.

Install this package

Install via git UPM:

您可以使用Unity Package Manager来安装使用该包。

You can use the Unity Package Manager to install and use this package.

git://github.com/yomunsam/TinaX.XComponent.git

package name: io.nekonya.tinax.xcomponent

If you want to set a target version, you can use release tag like #6.6.0-preview. for detail you can see this page: https://github.com/yomunsam/TinaX.XComponent/releases

Install via npm (UPM)

Modify Packages/manifest.json file in your project, and add the following code before "dependencies" node of this file:

"scopedRegistries": [
    {
        "name": "TinaX",
        "url": "https://registry.npmjs.org",
        "scopes": [
            "io.nekonya"
        ]
    }
],

Dependencies

This package does not depend on other packages.


The following documents are written in the author's native language. English documentation will be completed later.

The editor UI will automatically switch between Chinese and English based on the system language.

编辑器UI会根据系统语言自动切换中英语言。

无论是C#还是Lua, 在热更新项目中,我们是无法直接编写Component的。

一方面,Unity的编辑器不可能在Lua或者C#热更新Dll中读取组件来, 另一方面,对原生代码中的MonoBehaviour进行热修补也是所有热更新方案中不推荐的做法。

XComponent 将组件在编辑器上的部分和代码逻辑部分相互分离,为各种热更新方案提供便利。

TinaX.XComponent 虽然是TinaX Framework的一部分,但它没有依赖任何其他Package,甚至没有依赖TinaX.Core包。这意味着,任何人可以很轻易的把它放进各自不同的项目中,而不需要引入整套TinaX Framework的解决方案。

编辑器中的XComponent

XCompoent组件用于绑定各种Unity对象和基础类型数据,以代替MonoBehaviour中通过public变量的方式在编辑器进行对象绑定。

除了UnityEngine.Object对象之外,XComponent还可以绑定各种基础类型数据。并且这部分支持哪些数据是可以自由扩展的。

打开独立编辑窗口,我们可以精确的直接拖拽任何Unity对象进行绑定,而不是只能绑定GameObject和Prefab.

用于Lua方案

直接新建一个类,继承自TinaX.XComponent.XComponentScriptBase类,添加个TextAssets的Field,它就成了一个典型的MonoBehaviour了。

用于C#方案

代码和数据绑定是分开在不同的类中的:XComponent为C#提供了XBehaviour类来编写逻辑代码,XBehaviour是独立的抽象类,没有继承自MonoBehaviour.

使用C#做热更新的话,直接在热更新工程中继承XBehaviour即可。

GetComponent和AddComponent,也都很方便。