Giter Club home page Giter Club logo

unity-conditional-objects's Introduction

Conditional Objects

Scripts that modify GameObjects and Components at Prefab/Scene import time, based on build configurations. All processing is done in the editor at import/build time, so there's no runtime penalty in built players.

Features

  • Supported conditions:
    • Editor vs Built player
    • Development vs Release build settings
    • Scripting define symbols
    • Active build platform
  • Conditionally modify GameObject or Component properties with the PropertyModifier script (e.g.: setting different controller sprites between PlayStation and Xbox platforms)
  • Conditionally keep GameObjects or Components with the KeepObjectsModifier script (e.g.: keep a "Login with Google Play Games" button in Android only)
  • Conditionally delete GameObjects or Components with the DeleteObjectsModifier script (e.g.: delete a debug button in release builds)

How to install

Install via Unity Package Manager using the following URL:

https://github.com/gilzoide/unity-conditional-objects.git#1.0.0-preview2

Unity support

AImportTimeObjectModifier in Scenes are supported in all Unity versions.

Before Unity 2020.2, prefabs are only supported when directly instanced in scenes.

Creating your own modifier

  1. Create a script that inherits from AImportTimeObjectModifier
  2. Implement the abstract void Apply(bool filtersMatch) method inside a #if UNITY_EDITOR block. Check out the DeleteObjectsModifier script for an example.
  3. Add the script to your game objects in Prefabs/Scenes

Whenever a prefab with your script is reimported or a scene is processed (either played in editor or built), the modifier will be applied and immediately destroyed.

Known issues

  • UNITY_EDITOR and DEVELOPMENT_BUILD scripting define symbols are not detected correctly during builds, use the dedicated Editor and Development filters instead
  • Extra scripting define symbols passed to BuildPipeline.BuildPlayer are not detected correctly during builds

unity-conditional-objects's People

Contributors

gil-reis-supercompany avatar gilzoide avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.