Giter Site home page Giter Site logo

gameobjectref's Introduction

GOR​ ​-​ ​G​ame​O​bject​ ​R​eferences

v1.01

Overview

This​ ​plugin​ ​aims​ ​to​ ​ease​ ​the​ ​access​ ​of​ ​GameObjects​ ​in​ ​a​ ​scene​ ​from​ ​assets (AnimatorController,​ ​Prefabs​ ​or​ ​any​ ​other​ ​ScriptableObjects).

Concept​ ​-​ ​How​ ​it​ ​works

The​ ​idea​ ​is​ ​to​ ​create​ ​a​ ​link​ ​between​ ​the​ ​scene,​ ​an​ ​asset​ ​that​ ​will​ ​contains​ ​the​ ​reference​ ​at Start​ ​and​ ​the​ ​asset​ ​that​ ​need​ ​the​ ​GameObject​ ​reference. So,​ ​we​ ​start​ ​by​ ​creating​ ​a​ ​database​ ​of​ ​references​ ​where​ ​we​ ​define​ ​the​ ​name​ ​of​ ​the references. Then,​ ​we​ ​create​ ​a​ ​GameObject​ ​that​ ​bind​ ​other​ ​GameObjects​ ​of​ ​the​ ​scene​ ​to​ ​the​ ​database during​ ​the​ ​Start​ ​(so​ ​change​ ​the​ ​Script​ ​Execution​ ​Order​ ​can​ ​help). Afterwards,​ ​we​ ​can​ ​use​ ​GameObjectRef​ ​in​ ​a​ ​script​ ​in​ ​a​ ​Prefab/StateBehavior/etc.​ ​to​ ​bind​ ​to the​ ​database​ ​and​ ​the​ ​reference,​ ​and​ ​just​ ​use.”Get()”​ ​to​ ​access​ ​the​ ​GameObject​ ​from​ ​the database.

Steps

1​ ​-​ ​Creation​ ​of​ ​the​ ​GOR_ReferencesBinder Create​ ​an​ ​empty​ ​GameObject​ ​and​ ​add​ ​the​ ​GOR_ReferencesBinder​ ​script.

2​ ​-​ ​Use​ ​the​ ​“Create​ ​References​ ​Asset”​ ​to​ ​create​ ​the​ ​reference​ ​database.

Now,​ ​the​ ​database​ ​is​ ​bound,​ ​but​ ​it​ ​is empty​ ​for​ ​now.

You​ ​can​ ​select​ ​the​ ​database​ ​and​ ​add the​ ​number​ ​of​ ​references​ ​you​ ​want​ ​to set.

Or​ ​you​ ​can​ ​use​ ​the​ ​“Add​ ​new reference”​ ​shortcut​ ​from​ ​the GOR_ReferencesBinder​ ​to​ ​add​ ​a reference​ ​to​ ​the​ ​database​ ​so​ ​you don’t​ ​have​ ​to​ ​switch​ ​between​ ​the database​ ​and​ ​the GOR_ReferencesBinder.

3​ ​-​ ​Bind​ ​your​ ​GameObject​ ​using​ ​soft​ ​links

4​ ​-​ ​Add​ ​the​ ​GOR.GameObjectRef​ ​in​ ​your​ ​scripts

You​ ​can​ ​access​ ​your​ ​GameObject​ ​using​ ​GameObjectRef.Get()​ ​or​ ​directly​ ​a​ ​component using​ ​GameObjectRef.GetComponent<T>().

5​ ​-​ ​In​ ​the​ ​Inspector​ ​of​ ​your​ ​script, ​bind​ ​the​ ​database…

…​ ​and​ ​set​ ​the​ ​reference​ ​you​ ​want​ ​to use.​ ​You​ ​are​ ​done!

You​ ​can​ ​also​ ​add​ ​a​ ​new​ ​reference​ ​from​ ​here,​ ​by​ ​selecting​ ​“Add​ ​new​ ​ref.”

Link

GitHub : https://github.com/Begounet/GameObjectRef

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.