Skip to content

swipswaps/unity-core-project

 
 

Repository files navigation

Core Framework for Unity

Current Version 3

Supported Unity versions: 2019.1 or latest.

If you need to use the old scripting runtime (.net 3.5) then use the release-1.3 branch.

What is Core Framework?

The purpose of Core Framework is to help speed up development in Unity3D by providing the following basic systems every game needs to have:

  • Asset Bundle loading system that can load assets from:
    • Streaming assets folder
    • Web server or cloud service
    • Simulate asset bundles on editor
  • UI System
    • Basic implementation of Widgets, Dialogs and Panels
    • Transition animations by using DOTween, configurable on inspector
    • Can trigger sounds when a transition plays
  • Basic audio system
  • Mouse / Touch input control
  • Factory tool
  • Console window colors! Colorize your debug messages with colors so they are easier to read.
  • Base game starting point (Example Project)

Requirements

  • .Net 4.5.
  • .Net Standard 2.0

Demo

Example Project

Purpose

The main aspect of this library is loading and unloading asset bundles in a very simple way.

 var ball = await AssetService.LoadAsset<Ball>(AssetCategoryRoot.Prefabs,
            "Ball");

How to integrate into a project?

This project is meant to be added to an existing Unity Project, either by downloading it and placing it in the "Plugins" folder, or by setting it as a subtree to your git repo. Alternatively you can use the Example Project as a starting point.

Dependencies

Core Framework depends on the the following components

  • UniRx: And UniAsync.
  • Extenject: Core Framework libraries are loaded and used with Dependency Injectiion.
  • AssetBundles-Browser: Unity's tool for building and organizing asset bundles.
  • DOTween: Used in UI transitions.

Which platforms are compatible?

Has been tested on iOS, Android, Mac, Windows and WebGL.

Asset Bundles

For simplicity, the current asset bundle strategy for this tool is that each prefab is its own asset bundle, and asset bundles are organized by categories or directories. Image below is Unity's AssetBundles-Browser.

Asset Bundle Organization

These directories are mapped to the enum AssetCategoryRoot as shown below.

public enum AssetCategoryRoot
{
	None,
	Configuration,
	Services,
	Levels,
	SceneContent,
	GameContent,
	Windows,
	Audio,
	Prefabs
}

The service also detects the platform it's running on, and uses that to get the asset bundles from the web in the following order:

Cloud Asset Bundle Structure

This functionality is entirely seamless to the developer, thus requesting an asset is now as easy as:

   var shaterrer = await AssetService.LoadAsset<Shaterrer>(AssetCategoryRoot.Prefabs,
            Constants.Prefabs.Shaterrer);

Simulating Asset Bundles

Asset Bundle simulation is enabled by default. If you wish to disable it go to menu Core Framework -> Disable Simulate Asset Bundles.

Core Framework Preferences

Alternatively, there's also a _Core menu to enable/disable simulation mode

Core Menu

Asset Service Options

  • Use Streaming Assets
    • Toggling this will load the asset bundles from the streaming assets folder
  • Asset Bundles URL
    • Location where the asset bundles are stored on the cloud
  • Cache Asset Bundles?
    • Toggle this if you want to cache the asset bundles on device. The file UnityCloudBuildManifest.json needs to be present in order to cache bundles.

Console window colors!

This feature allows you to easily colorize debug messages so you can keep track of related events by colors on editor. This functionality is disabled on builds so the console log doesn't become cluttered with color tags.

By using the logger, device logs are not littered with tags. thus are easier to read.

Asset Service Options

   Logger.Log("My very awesome lime colored text!"",Colors.Lime);

About

Core Framework for Unity

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.9%
  • Other 0.1%