instead of Entity[]. Use the command line tool `MigrationAssistant.exe` to automatically migrate.
```
$ mono MigrationAssistant.exe
usage:
[-l] - print all available versions
[version] [path] - apply migration of version [version] to source files located at [path]
$ mono MigrationAssistant.exe -l
0.18.0 - Migrates IReactiveSystem API
0.19.0 - Migrates IReactiveSystem.Execute
// Example from Math-One example project, where all the systems are located in the Features folder
$ mono MigrationAssistant.exe 0.19.0 /Path/To/Project/Assets/Sources/Features
```
---
Entitas 0.18.0 upgrade guide
============================
Entitas 0.18.0 changes IReactiveSystem. To upgrade your source files, follow these steps
- Install Entitas 0.18.0 (which will result in compiler errors)
- Use the command line tool `MigrationAssistant.exe` to automatically migrate
```
$ mono MigrationAssistant.exe
usage:
[-l] - print all available versions
[version] [path] - apply migration of version [version] to source files located at [path]
$ mono MigrationAssistant.exe -l
0.18.0 - Migrates IReactiveSystem API
// Example from Math-One example project, where all the systems are located in the Features folder
$ mono MigrationAssistant.exe 0.18.0 /Path/To/Project/Assets/Sources/Features
```
---
Entitas 0.12.0 upgrade guide
============================
Entitas 0.12.0 generates prefixed matchers based on the PoolAttribute and introduces some
API changes. In your existing project with a Entitas version < 0.12.0 manually rename the
following classes and methods.
## Before installing Entitas 0.12.0
#### Rename
pool.CreateSystem() -> pool.CreateExecuteSystem()
Now that you're prepared for integrating the latest version, delete your existing version
of Entitas, EntitasCodeGenerator and EntitasUnity.
#### Delete
Entitas
EntitasCodeGenerator
EntitasUnity
## Install Entitas 0.12.0
#### Setup Entitas Preferences
Open the Unity preference panel and select Entitas. Check and update the path to the folder where
the code generator will save all generated files. If you are using the PoolAttribute in your components,
add all custom pool names used in your application. Make sure that all existing custom PoolAttributes call
the base constructor with the same name as the class (without 'Attribute').
If you are not using the PoolAttribute in your components, you can skip this process.
```cs
using Entitas.CodeGenerator;
public class CoreGameAttribute : PoolAttribute {
public CoreGameAttribute() : base("CoreGame") {
}
}
```
#### Code Generator
Use the code generator and generate
#### Update API
Click the MenuItem "Entitas/Update API". All occurrences of the old Matcher will be updated
to the new version, which is prefixed based on the PoolAttribute.
#### Delete
Delete all custom PoolAttributes
---
Entitas 0.10.0 upgrade guide
============================
Beside features, Entitas 0.10.0 includes lots of renaming. If your current Entitas
version is < 0.10.0, you might want to follow the next few simple renaming steps,
to speed up the integration of the latest version of Entitas.
In your existing project with a Entitas version < 0.10.0 manually rename the following
classes and methods.
## Before installing Entitas 0.10.0
#### Rename
EntityRepository -> Pool
EntityRepository.GetCollection() -> Pool.GetGroup()
EntityCollection -> Group
EntityCollection.EntityCollectionChange -> Group.GroupChanged
EntityRepositoryObserver -> GroupObserver
EntityRepositoryObserver.EntityCollectionEventType -> GroupObserver.GroupEventType
IEntityMatcher -> IMatcher
IEntitySystem -> IExecuteSystem
AllOfEntityMatcher -> AllOfMatcher
EntityRepositoryAttribute -> PoolAttribute
IReactiveSubEntitySystem -> IReactiveSystem
ReactiveEntitySystem -> ReactiveSystem
#### Delete
EntityWillBeRemovedEntityRepositoryObserver -> DELETE
IReactiveSubEntityWillBeRemovedSystem -> DELETE
ReactiveEntityWillBeRemovedSystem -> DELETE
Now that you're prepared for integrating the latest version, delete your existing version
of Entitas, EntitasCodeGenerator and ToolKit.
#### Delete
Entitas
EntitasCodeGenerator
ToolKit (unless you use classes from ToolKit. The new version of Entitas doesn't depend on ToolKit anymore)
## Install Entitas 0.10.0
#### Fix remaining issues
IReactiveSubEntityWillBeRemovedSystem
- Consider implementing ISystem & ISetPool and use group.OnEntityWillBeRemoved += foobar;
#### Code Generator
Use the code generator and generate
================================================
FILE: LICENSE.md
================================================
The MIT License
Copyright (c) 2014 - 2023 Simon Schmid
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================
FILE: README.md
================================================
Entitas is free, but powered by
your donations
# Entitas - The Entity Component System Framework for C# and Unity
Entitas is the most popular open-source Entity Component System Framework (ECS)
and is specifically made for C# and Unity. Several design decisions have been
made to work optimal in a garbage collected environment and to go easy on the
garbage collector. Entitas comes with an optional code generator which radically
reduces the amount of code you have to write and
[makes your code read like well written prose.](https://cleancoders.com)
# Why Entitas
- [#1 open-source ECS on GitHub](https://github.com/sschmid/Entitas)
- 100% open-source under the [MIT License](LICENSE.md)
- great and helpful community on [Discord](https://discord.gg/uHrVx5Z)
- easy to learn and easy to use
- works great in pure C# standalone projects without Unity
- comes with great Unity integration called Visual Debugging
- battle-tested at companies like [Popcore](https://popcore.com) (Rollic / Zynga / Take Two), [Gram Games](https://gram.gs), [Wooga](https://www.wooga.com), [Plarium](https://plarium.com), [Storm Chaser](https://www.stormchaser-games.com) and many more
# Video Tutorials and Unity Unite Talks
| Video | Title | Resources |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------|-------------------------------------------------------------------------------------|
|
| Entitas ECS Unity Tutorial - Git & Unit Tests | |
|
| Entitas ECS Unity Tutorial - Setup & Basics | |
|
| Unite Europe 2016: ECS architecture with Unity by example | [SlideShare: Unite Europe 2016](http://www.slideshare.net/sschmid/uniteeurope-2016) |
|
| Unite Europe 2015: Entity system architecture with Unity | [SlideShare: Unite Europe 2015](http://www.slideshare.net/sschmid/uniteeurope-2015) |
# First glimpse
The optional [code generator](https://github.com/sschmid/Entitas/wiki/Code-Generator)
lets you write code that is super fast, safe and literally screams its intent.
```csharp
var entity = context.CreateEntity();
entity.AddPosition(Vector3.zero);
entity.AddVelocity(Vector3.forward);
entity.AddAsset("Player");
```
```csharp
using static GameMatcher;
public sealed class MoveSystem : IExecuteSystem
{
readonly IGroup _group;
public MoveSystem(GameContext context)
{
_group = context.GetGroup(AllOf(Position, Velocity));
}
public void Execute()
{
foreach (var e in _group.GetEntities())
e.ReplacePosition(e.position.value + e.velocity.value);
}
}
```
# Overview
Entitas is fast, light and gets rid of unnecessary complexity. There are less
than a handful classes you have to know to rocket start your game or application:
- Context
- Entity
- Component
- Group
```
Entitas ECS
+-----------------+
| Context |
|-----------------|
| e e | +-----------+
| e e--|----> | Entity |
| e e | |-----------|
| e e e | | Component |
| e e | | | +-----------+
| e e | | Component-|----> | Component |
| e e e | | | |-----------|
| e e e | | Component | | Data |
+-----------------+ +-----------+ +-----------+
|
|
| +-------------+ Groups:
| | e | Subsets of entities in the context
| | e e | for blazing fast querying
+---> | +------------+
| e | | |
| e | e | e |
+--------|----+ e |
| e |
| e e |
+------------+
```
[Read more...](https://github.com/sschmid/Entitas/wiki/Home)
# Code Generator
The Code Generator generates classes and methods for you, so you can focus on
getting the job done. It radically reduces the amount of code you have to write
and improves readability by a huge magnitude. It makes your code less error-prone
while ensuring best performance.
[Read more...](https://github.com/sschmid/Entitas/wiki/Code-Generator)
# Unity integration
The optional Unity module "Visual Debugging" integrates Entitas nicely into Unity and provides powerful
editor extensions to inspect and debug contexts, groups, entities, components and systems.
[Read more...](https://github.com/sschmid/Entitas/wiki/Unity-integration)

# Entitas deep dive
[Read the wiki](https://github.com/sschmid/Entitas/wiki) or checkout the [example projects](https://github.com/sschmid/Entitas/wiki/Example-projects) to
see Entitas in action. These example projects illustrate how systems, groups, collectors and entities all play together seamlessly.
### **[» Download and setup](#download-and-setup-entitas)**
### **[» Video Tutorials and Unity Unite Talks](#video-tutorials-and-unity-unite-talks)**
### **[» Wiki and example projects](https://github.com/sschmid/Entitas/wiki)**
### **[» Ask a question](https://github.com/sschmid/Entitas/issues/new)**
---
# Download and setup Entitas
### GitHub releases (recommended)
[Show releases](https://github.com/sschmid/Entitas/releases)
### Unity package manager
> Coming soon
### NuGet
Entitas and all dependencies are available as [NuGet packages](https://www.nuget.org/packages?q=Entitas).
More detailed explanation coming soon.
### Unity Asset Store (deprecated)
[Entitas on the Unity Asset Store](http://u3d.as/NuJ) is deprecated and will not
be updated anymore. The last version available on the Asset Store is 1.12.3 and
is free to download. Please see discussion [Entitas turns 7 - and is FREE now ](https://github.com/sschmid/Entitas/discussions/1009)
# Thanks to
Big shout out to [@mzaks][github-mzaks], [@cloudjubei][github-cloudjubei] and [@devboy][github-devboy]
for endless hours of discussion and helping making Entitas awesome!
[github-mzaks]: https://github.com/mzaks "@mzaks"
[github-cloudjubei]: https://github.com/cloudjubei "@cloudjubei"
[github-devboy]: https://github.com/devboy "@devboy"
# Maintainers
- [@sschmid][github-sschmid] | [@s_schmid][twitter-sschmid] | [@entitas_csharp][twitter-entitas_csharp]
[github-sschmid]: https://github.com/sschmid "@sschmid"
[twitter-sschmid]: https://twitter.com/s_schmid "s_schmid on Twitter"
[twitter-entitas_csharp]: https://twitter.com/entitas_csharp "entitas_csharp on Twitter"
# Different language?
Entitas is available in
- [C#](https://github.com/sschmid/Entitas)
- [C++](https://github.com/JuDelCo/Entitas-Cpp)
- [Clojure](https://github.com/mhaemmerle/entitas-clj)
- [Crystal](https://github.com/spoved/entitas.cr)
- [Erlang](https://github.com/mhaemmerle/entitas_erl)
- [F#](https://github.com/darkoverlordofdata/entitas-fsharp)
- [Go](https://github.com/wooga/go-entitas)
- [Haskell](https://github.com/mhaemmerle/entitas-haskell)
- [Java](https://github.com/Rubentxu/entitas-java)
- [Kotlin](https://github.com/darkoverlordofdata/entitas-kotlin)
- [Objective-C](https://github.com/wooga/entitas)
- [Python](https://github.com/Aenyhm/entitas-python)
- [Scala](https://github.com/darkoverlordofdata/entitas-scala)
- [Swift](https://github.com/mzaks/Entitas-Swift)
- [TypeScript](https://github.com/darkoverlordofdata/entitas-ts)
================================================
FILE: Unity3D.props
================================================
C:/Program Files
Editor/Data/Managed
/Applications
Unity.app/Contents/Managed
$([System.Environment]::GetFolderPath('System.Environment+SpecialFolder.UserProfile'))
Editor/Data/Managed
$(OSApplicationPath)/Unity/Hub/Editor
$(UnityManagedPath)/UnityEngine.dll
$(UnityManagedPath)/UnityEditor.dll
================================================
FILE: benchmarks/Entitas.Benchmarks/AERCBenchmarks.cs
================================================
#nullable disable
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Order;
// | Method | Mean | Error | StdDev | Rank | Allocated |
// |----------- |----------:|----------:|----------:|-----:|----------:|
// | UnsafeAERC | 1.153 ns | 0.0035 ns | 0.0033 ns | 1 | - |
// | SafeAERC | 18.992 ns | 0.0751 ns | 0.0665 ns | 2 | - |
namespace Entitas.Benchmarks
{
[MemoryDiagnoser]
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
[RankColumn]
public class AERCBenchmarks
{
SafeAERC _safeAerc;
UnsafeAERC _unsafeAerc;
[GlobalSetup]
public void GlobalSetup()
{
_safeAerc = new SafeAERC(null);
_unsafeAerc = new UnsafeAERC();
}
[Benchmark]
public void SafeAERC()
{
_safeAerc.Retain(this);
_safeAerc.Release(this);
}
[Benchmark]
public void UnsafeAERC()
{
_unsafeAerc.Retain(this);
_unsafeAerc.Release(this);
}
}
}
================================================
FILE: benchmarks/Entitas.Benchmarks/CreateComponentBenchmarks.cs
================================================
#nullable disable
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Order;
// | Method | Mean | Error | StdDev | Rank | Gen0 | Allocated |
// |---------- |---------:|----------:|----------:|-----:|-------:|----------:|
// | Manual | 3.392 ns | 0.0159 ns | 0.0149 ns | 1 | 0.0115 | 24 B |
// | Generic | 8.100 ns | 0.0564 ns | 0.0500 ns | 2 | 0.0115 | 24 B |
// | Activator | 9.741 ns | 0.0352 ns | 0.0312 ns | 3 | 0.0115 | 24 B |
namespace Entitas.Benchmarks
{
[MemoryDiagnoser]
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
[RankColumn]
public class CreateComponentBenchmarks
{
Entity _entity;
[GlobalSetup]
public void GlobalSetup()
{
var context = new Context(1, () => new Entity());
_entity = context.CreateEntity();
}
[Benchmark]
public MovableComponent Activator()
{
return (MovableComponent)_entity.CreateComponent(0, typeof(MovableComponent));
}
[Benchmark]
public MovableComponent Generic()
{
return _entity.CreateComponent(0);
}
[Benchmark]
public MovableComponent Manual()
{
var componentPool = _entity.GetComponentPool(0);
return componentPool.Count > 0
? (MovableComponent)componentPool.Pop()
: new MovableComponent();
}
}
public sealed class MovableComponent : IComponent { }
}
================================================
FILE: benchmarks/Entitas.Benchmarks/DelegateBenchmarks.cs
================================================
#nullable disable
using System;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Order;
// | Method | Mean | Error | StdDev | Rank | Gen0 | Allocated |
// |--------------- |----------:|----------:|----------:|-----:|-------:|----------:|
// | Delegate | 4.674 ns | 0.0105 ns | 0.0093 ns | 1 | 0.0115 | 24 B |
// | InstanceMethod | 10.458 ns | 0.0646 ns | 0.0604 ns | 2 | 0.0421 | 88 B |
namespace Entitas.Benchmarks
{
[MemoryDiagnoser]
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
[RankColumn]
public class DelegateBenchmarks
{
static readonly Func TimesTwoDelegate = a => a + a;
int TimesTwo(int a) => a + a;
[Benchmark]
public void InstanceMethod()
{
new MyClass(TimesTwo).Invoke(1);
}
[Benchmark]
public void Delegate()
{
new MyClass(TimesTwoDelegate).Invoke(1);
}
class MyClass
{
readonly Func _method;
public MyClass(Func method)
{
_method = method;
}
public int Invoke(int a) => _method(a);
}
}
}
================================================
FILE: benchmarks/Entitas.Benchmarks/Entitas.Benchmarks.csproj
================================================
Exe
$(DefaultTestTargetFramework)
enable
false
false
================================================
FILE: benchmarks/Entitas.Benchmarks/Program.cs
================================================
using BenchmarkDotNet.Running;
using Entitas.Benchmarks;
// BenchmarkRunner.Run();
// BenchmarkRunner.Run();
BenchmarkRunner.Run();
================================================
FILE: gen/Entitas.Generators/Component/ComponentDeclaration.cs
================================================
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
namespace Entitas.Generators
{
public readonly struct ComponentDeclaration
{
public readonly SyntaxTree? SyntaxTree;
public readonly string? Namespace;
public readonly string FullName;
public readonly string Name;
public readonly ImmutableArray Members;
public readonly ImmutableArray Contexts;
public readonly bool IsUnique;
public readonly int CleanupMode;
public readonly ImmutableArray Events;
public readonly string FullPrefix;
public readonly string Prefix;
public ComponentDeclaration(SyntaxTree? syntaxTree, INamedTypeSymbol symbol, ImmutableArray contexts)
{
SyntaxTree = syntaxTree;
Namespace = !symbol.ContainingNamespace.IsGlobalNamespace ? symbol.ContainingNamespace.ToDisplayString() : null;
FullName = symbol.ToDisplayString();
Name = symbol.Name;
Members = symbol.GetMembers()
.Where(member => member.DeclaredAccessibility == Accessibility.Public
&& !member.IsStatic
&& member.CanBeReferencedByName
&& member is IFieldSymbol or IPropertySymbol { SetMethod: not null, GetMethod: not null })
.Select(static member => member switch
{
IFieldSymbol field => new MemberDeclaration(field),
IPropertySymbol property => new MemberDeclaration(property),
_ => null
})
.OfType()
.ToImmutableArray();
Contexts = contexts;
IsUnique = symbol.GetAttributes().Any(static attribute => attribute.AttributeClass?.ToDisplayString() == "Entitas.Generators.Attributes.UniqueAttribute");
var cleanupMode = symbol
.GetAttributes()
.FirstOrDefault(static attribute => attribute.AttributeClass?.ToDisplayString() == "Entitas.Generators.Attributes.CleanupAttribute")?
.ConstructorArguments.FirstOrDefault();
CleanupMode = cleanupMode?.Type?.ToDisplayString() == "Entitas.Generators.Attributes.CleanupMode" && cleanupMode.Value.Value is int mode ? mode : -1;
var prefix = Name.RemoveSuffix("Component");
Events = symbol.GetAttributes()
.Where(static attribute => attribute.AttributeClass?.ToDisplayString() == "Entitas.Generators.Attributes.EventAttribute")
.Select(static attribute => attribute.ConstructorArguments)
.Select, EventDeclaration?>(args =>
{
var eventTarget = args.Length > 0 && args[0].Type?.ToDisplayString() == "Entitas.Generators.Attributes.EventTarget" && args[0].Value is int eventTargetValue ? eventTargetValue : -1;
if (eventTarget == -1)
return null;
var eventType = args.Length > 1 && args[1].Type?.ToDisplayString() == "Entitas.Generators.Attributes.EventType" && args[1].Value is int eventTypeValue ? eventTypeValue : 0;
var order = args.Length > 2 && args[2].Type?.ToDisplayString() == "int" && args[2].Value is int orderValue ? orderValue : 0;
return new EventDeclaration(eventTarget, eventType, order, prefix);
})
.OfType()
.ToImmutableArray();
FullPrefix = FullName.Replace(".", string.Empty).RemoveSuffix("Component");
Prefix = prefix;
}
ComponentDeclaration(ComponentDeclaration component, string fullName, string name, ImmutableArray members, string prefix)
{
SyntaxTree = component.SyntaxTree;
Namespace = component.Namespace;
FullName = fullName;
Name = name;
Members = members;
Contexts = component.Contexts;
IsUnique = false;
CleanupMode = -1;
Events = ImmutableArray.Empty;
FullPrefix = prefix;
Prefix = prefix;
}
public ComponentDeclaration ToEvent(string fullName, string name, ImmutableArray members, string componentPrefix)
{
return new ComponentDeclaration(this, fullName, name, members, componentPrefix);
}
public string ContextAwareComponentPrefix(string contextPrefix)
{
return contextPrefix.Replace(".", string.Empty) + Prefix;
}
}
public class FullNameAndContextsComparer : IEqualityComparer
{
public static readonly FullNameAndContextsComparer Instance = new FullNameAndContextsComparer();
public bool Equals(ComponentDeclaration x, ComponentDeclaration y) =>
x.FullName == y.FullName &&
x.Contexts.SequenceEqual(y.Contexts);
public int GetHashCode(ComponentDeclaration obj)
{
unchecked
{
return (obj.FullName.GetHashCode() * 397) ^ obj.Contexts.GetHashCode();
}
}
}
public class FullNameAndMembersAndContextsComparer : IEqualityComparer
{
readonly IEqualityComparer _memberComparer;
public FullNameAndMembersAndContextsComparer(IEqualityComparer memberComparer)
{
_memberComparer = memberComparer;
}
public bool Equals(ComponentDeclaration x, ComponentDeclaration y) =>
x.FullName == y.FullName &&
x.Members.SequenceEqual(y.Members, _memberComparer) &&
x.Contexts.SequenceEqual(y.Contexts);
public int GetHashCode(ComponentDeclaration obj)
{
unchecked
{
var hashCode = obj.FullName.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Members.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Contexts.GetHashCode();
return hashCode;
}
}
}
public class FullNameAndMembersAndContextsAndIsUniqueComparer : IEqualityComparer
{
readonly IEqualityComparer _memberComparer;
public FullNameAndMembersAndContextsAndIsUniqueComparer(IEqualityComparer memberComparer)
{
_memberComparer = memberComparer;
}
public bool Equals(ComponentDeclaration x, ComponentDeclaration y) =>
x.FullName == y.FullName &&
x.Members.SequenceEqual(y.Members, _memberComparer) &&
x.Contexts.SequenceEqual(y.Contexts) &&
x.IsUnique == y.IsUnique;
public int GetHashCode(ComponentDeclaration obj)
{
unchecked
{
var hashCode = obj.FullName.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Members.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Contexts.GetHashCode();
hashCode = (hashCode * 397) ^ obj.IsUnique.GetHashCode();
return hashCode;
}
}
}
public class FullNameAndContextsAndCleanupModeComparer : IEqualityComparer
{
public static readonly FullNameAndContextsAndCleanupModeComparer Instance = new FullNameAndContextsAndCleanupModeComparer();
public bool Equals(ComponentDeclaration x, ComponentDeclaration y) =>
x.FullName == y.FullName &&
x.Contexts.SequenceEqual(y.Contexts) &&
x.CleanupMode == y.CleanupMode;
public int GetHashCode(ComponentDeclaration obj)
{
unchecked
{
var hashCode = obj.FullName.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Contexts.GetHashCode();
hashCode = (hashCode * 397) ^ obj.CleanupMode.GetHashCode();
return hashCode;
}
}
}
public class FullNameAndMembersAndContextsAndEventsComparer : IEqualityComparer
{
readonly IEqualityComparer _memberComparer;
readonly IEqualityComparer _eventComparer;
public FullNameAndMembersAndContextsAndEventsComparer(IEqualityComparer memberComparer, IEqualityComparer eventComparer)
{
_memberComparer = memberComparer;
_eventComparer = eventComparer;
}
public bool Equals(ComponentDeclaration x, ComponentDeclaration y) =>
x.FullName == y.FullName &&
x.Members.SequenceEqual(y.Members, _memberComparer) &&
x.Contexts.SequenceEqual(y.Contexts) &&
x.Events.SequenceEqual(y.Events, _eventComparer);
public int GetHashCode(ComponentDeclaration obj)
{
unchecked
{
var hashCode = obj.FullName.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Members.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Contexts.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Events.GetHashCode();
return hashCode;
}
}
}
public class FullNameAndContextsAndEventsComparer : IEqualityComparer
{
readonly IEqualityComparer _eventComparer;
public FullNameAndContextsAndEventsComparer(IEqualityComparer eventComparer)
{
_eventComparer = eventComparer;
}
public bool Equals(ComponentDeclaration x, ComponentDeclaration y) =>
x.FullName == y.FullName &&
x.Contexts.SequenceEqual(y.Contexts) &&
x.Events.SequenceEqual(y.Events, _eventComparer);
public int GetHashCode(ComponentDeclaration obj)
{
unchecked
{
var hashCode = obj.FullName.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Contexts.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Events.GetHashCode();
return hashCode;
}
}
}
public class ComponentsComparer : IEqualityComparer>
{
readonly IEqualityComparer _comparer;
public ComponentsComparer(IEqualityComparer comparer)
{
_comparer = comparer;
}
public bool Equals(ImmutableArray x, ImmutableArray y) =>
x.SequenceEqual(y, _comparer);
public int GetHashCode(ImmutableArray obj) => obj.GetHashCode();
}
}
================================================
FILE: gen/Entitas.Generators/Component/ComponentGenerator.CleanupSystem.cs
================================================
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
partial class ComponentGenerator
{
static void CleanupSystem(SourceProductionContext spc, ComponentDeclaration component, string context, AnalyzerConfigOptionsProvider optionsProvider)
{
if (component.CleanupMode == -1)
return;
if (!EntitasAnalyzerConfigOptions.ComponentCleanupSystems(optionsProvider, component.SyntaxTree))
return;
var cleanupSystemPrefix = component.CleanupMode == 0 ? "Remove" : "Destroy";
var cleanupAction = component.CleanupMode == 0 ? $"Remove{component.Prefix}" : "Destroy";
var contextPrefix = ContextPrefix(context);
var contextAwareComponentPrefix = component.ContextAwareComponentPrefix(contextPrefix);
var className = $"{cleanupSystemPrefix}{contextAwareComponentPrefix}CleanupSystem";
spc.AddSource(
GeneratedPath(CombinedNamespace(component.Namespace, className)),
GeneratedFileHeader(GeneratorSource(nameof(CleanupSystem))) +
NamespaceDeclaration(component.Namespace,
$$"""
public sealed class {{className}} : global::Entitas.ICleanupSystem
{
readonly global::Entitas.IGroup _group;
readonly global::System.Collections.Generic.List _buffer = new global::System.Collections.Generic.List();
public {{className}}(global::{{context}} context)
{
_group = context.GetGroup({{contextAwareComponentPrefix}}Matcher.{{component.Prefix}});
}
public void Cleanup()
{
foreach (var entity in _group.GetEntities(_buffer))
{
entity.{{cleanupAction}}();
}
}
}
"""));
}
}
}
================================================
FILE: gen/Entitas.Generators/Component/ComponentGenerator.CleanupSystems.cs
================================================
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
partial class ComponentGenerator
{
static void CleanupSystems(SourceProductionContext spc, ContextInitializationMethodDeclaration method, AnalyzerConfigOptionsProvider optionsProvider)
{
if (!EntitasAnalyzerConfigOptions.ComponentCleanupSystems(optionsProvider, method.SyntaxTree))
return;
spc.AddSource(
GeneratedPath($"{method.ContextFullName}CleanupSystemsExtension"),
GeneratedFileHeader(GeneratorSource(nameof(CleanupSystems))) +
NamespaceDeclaration(method.ContextNamespace,
$$"""
public static class {{method.ContextName}}CleanupSystemsExtension
{
public static global::Entitas.Systems CreateCleanupSystems(this {{method.ContextName}} context)
{
{{AddCleanupSystems(method.Components, method.FullContextPrefix)}}
}
}
"""));
static string AddCleanupSystems(ImmutableArray components, string contextPrefix)
{
return components.Length == 0
? " return null;"
: $$"""
var systems = new global::Entitas.Systems();
{{string.Join("\n", components.Select(component =>
{
var cleanupSystemPrefix = component.CleanupMode == 0 ? "Remove" : "Destroy";
return $" systems.Add(new global::{CombinedNamespace(component.Namespace, cleanupSystemPrefix)}{component.ContextAwareComponentPrefix(contextPrefix)}CleanupSystem(context));";
}))}}
return systems;
""";
}
}
}
}
================================================
FILE: gen/Entitas.Generators/Component/ComponentGenerator.ComponentIndex.cs
================================================
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
partial class ComponentGenerator
{
static void ComponentIndex(SourceProductionContext spc, ComponentDeclaration component, string context, AnalyzerConfigOptionsProvider optionsProvider)
{
if (!EntitasAnalyzerConfigOptions.ComponentComponentIndex(optionsProvider, component.SyntaxTree))
return;
var contextPrefix = ContextPrefix(context);
var contextAwareComponentPrefix = component.ContextAwareComponentPrefix(contextPrefix);
var className = $"{contextAwareComponentPrefix}ComponentIndex";
spc.AddSource(
GeneratedPath(CombinedNamespace(component.Namespace, className)),
GeneratedFileHeader(GeneratorSource(nameof(ComponentIndex))) +
NamespaceDeclaration(component.Namespace,
$$"""
public static class {{className}}
{
public static global::{{contextPrefix}}.ComponentIndex Index;
}
"""));
}
}
}
================================================
FILE: gen/Entitas.Generators/Component/ComponentGenerator.ContextExtension.cs
================================================
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
partial class ComponentGenerator
{
static void ContextExtension(SourceProductionContext spc, ComponentDeclaration component, string context, AnalyzerConfigOptionsProvider optionsProvider)
{
if (!component.IsUnique)
return;
if (!EntitasAnalyzerConfigOptions.ComponentContextExtension(optionsProvider, component.SyntaxTree))
return;
var contextPrefix = ContextPrefix(context);
var contextAwareComponentPrefix = component.ContextAwareComponentPrefix(contextPrefix);
var className = $"{contextAwareComponentPrefix}ContextExtension";
string content;
if (component.Members.Length > 0)
{
content = $$"""
public static class {{className}}
{
public static bool Has{{component.Prefix}}(this global::{{context}} context)
{
return context.Get{{component.Prefix}}Entity() != null;
}
public static global::{{contextPrefix}}.Entity Set{{component.Prefix}}(this global::{{context}} context, {{ComponentMethodParams(component)}})
{
if (context.Has{{component.Prefix}}())
{
throw new global::Entitas.EntitasException(
$"Could not set {{component.Prefix}}!\n{context} already has an entity with {{component.FullName}}!",
"You should check if the context already has a {{component.Prefix}}Entity before setting it or use context.Replace{{component.Prefix}}()."
);
}
return context.CreateEntity().Add{{component.Prefix}}({{ComponentMethodArgs(component)}});
}
public static global::{{contextPrefix}}.Entity Replace{{component.Prefix}}(this global::{{context}} context, {{ComponentMethodParams(component)}})
{
var entity = context.Get{{component.Prefix}}Entity();
if (entity == null)
entity = context.CreateEntity().Add{{component.Prefix}}({{ComponentMethodArgs(component)}});
else
entity.Replace{{component.Prefix}}({{ComponentMethodArgs(component)}});
return entity;
}
public static void Remove{{component.Prefix}}(this global::{{context}} context)
{
context.Get{{component.Prefix}}Entity().Destroy();
}
public static global::{{contextPrefix}}.Entity Get{{component.Prefix}}Entity(this global::{{context}} context)
{
return context.GetGroup({{contextAwareComponentPrefix}}Matcher.{{component.Prefix}}).GetSingleEntity();
}
public static {{component.Name}} Get{{component.Prefix}}(this global::{{context}} context)
{
return context.Get{{component.Prefix}}Entity().Get{{component.Prefix}}();
}
}
""";
}
else
{
content = $$"""
public static class {{className}}
{
public static bool Has{{component.Prefix}}(this global::{{context}} context)
{
return context.Get{{component.Prefix}}Entity() != null;
}
public static global::{{contextPrefix}}.Entity Set{{component.Prefix}}(this global::{{context}} context)
{
return context.Get{{component.Prefix}}Entity() ?? context.CreateEntity().Add{{component.Prefix}}();
}
public static void Unset{{component.Prefix}}(this global::{{context}} context)
{
context.Get{{component.Prefix}}Entity()?.Destroy();
}
public static global::{{contextPrefix}}.Entity Get{{component.Prefix}}Entity(this global::{{context}} context)
{
return context.GetGroup({{contextAwareComponentPrefix}}Matcher.{{component.Prefix}}).GetSingleEntity();
}
}
""";
}
spc.AddSource(
GeneratedPath(CombinedNamespace(component.Namespace, className)),
GeneratedFileHeader(GeneratorSource(nameof(ContextExtension))) +
NamespaceDeclaration(component.Namespace, content));
}
}
}
================================================
FILE: gen/Entitas.Generators/Component/ComponentGenerator.ContextInitializationMethod.cs
================================================
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
partial class ComponentGenerator
{
static void ContextInitializationMethod(SourceProductionContext spc, ContextInitializationMethodDeclaration method, AnalyzerConfigOptionsProvider optionsProvider)
{
if (!EntitasAnalyzerConfigOptions.ComponentContextInitializationMethod(optionsProvider, method.SyntaxTree))
return;
spc.AddSource(
GeneratedPath(CombinedNamespace(method.Namespace, $"{method.Class}.{method.Name}.ContextInitialization")),
GeneratedFileHeader(GeneratorSource(nameof(ContextInitializationMethod))) +
NamespaceDeclaration(method.Namespace,
$$"""
public static partial class {{method.Class}}
{
public static partial void {{method.Name}}()
{
{{ComponentIndexAssignments(method, method.Components)}}
global::{{method.ContextFullName}}.ComponentNames = new string[]
{
{{ComponentNames(method.Components)}}
};
global::{{method.ContextFullName}}.ComponentTypes = new global::System.Type[]
{
{{ComponentTypes(method.Components)}}
};
}
}
"""));
static string ComponentIndexAssignments(ContextInitializationMethodDeclaration method, ImmutableArray components)
{
return string.Join("\n", components.Select((component, i) =>
{
var contextPrefix = "global::" + CombinedNamespace(component.Namespace, ContextAware(method.FullContextPrefix).Replace(".", string.Empty));
return $" {contextPrefix}{component.Prefix}ComponentIndex.Index = new global::{method.FullContextPrefix}.ComponentIndex({i});";
}));
}
static string ComponentNames(ImmutableArray components)
{
return string.Join(",\n", components.Select(static component => $" \"{component.FullName.RemoveSuffix("Component")}\""));
}
static string ComponentTypes(ImmutableArray components)
{
return string.Join(",\n", components.Select(static component => $" typeof(global::{component.FullName})"));
}
}
}
}
================================================
FILE: gen/Entitas.Generators/Component/ComponentGenerator.EntityExtension.cs
================================================
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
partial class ComponentGenerator
{
static void EntityExtension(SourceProductionContext spc, ComponentDeclaration component, string context, AnalyzerConfigOptionsProvider optionsProvider)
{
if (!EntitasAnalyzerConfigOptions.ComponentEntityExtension(optionsProvider, component.SyntaxTree))
return;
var contextPrefix = ContextPrefix(context);
var contextAwareComponentPrefix = component.ContextAwareComponentPrefix(contextPrefix);
var className = $"{contextAwareComponentPrefix}EntityExtension";
var index = $"{contextAwareComponentPrefix}ComponentIndex.Index.Value";
string content;
if (component.Members.Length > 0)
{
content = $$"""
public static class {{className}}
{
public static bool Has{{component.Prefix}}(this global::{{contextPrefix}}.Entity entity)
{
return entity.HasComponent({{index}});
}
public static global::{{contextPrefix}}.Entity Add{{component.Prefix}}(this global::{{contextPrefix}}.Entity entity, {{ComponentMethodParams(component)}})
{
var index = {{index}};
var componentPool = entity.GetComponentPool(index);
var component = componentPool.Count > 0
? ({{component.Name}})componentPool.Pop()
: new {{component.Name}}();
{{ComponentValueAssignments(component)}}
entity.AddComponent(index, component);
return entity;
}
public static global::{{contextPrefix}}.Entity Replace{{component.Prefix}}(this global::{{contextPrefix}}.Entity entity, {{ComponentMethodParams(component)}})
{
var index = {{index}};
var componentPool = entity.GetComponentPool(index);
var component = componentPool.Count > 0
? ({{component.Name}})componentPool.Pop()
: new {{component.Name}}();
{{ComponentValueAssignments(component)}}
entity.ReplaceComponent(index, component);
return entity;
}
public static global::{{contextPrefix}}.Entity Remove{{component.Prefix}}(this global::{{contextPrefix}}.Entity entity)
{
entity.RemoveComponent({{index}});
return entity;
}
public static {{component.Name}} Get{{component.Prefix}}(this global::{{contextPrefix}}.Entity entity)
{
return ({{component.Name}})entity.GetComponent({{index}});
}
}
""";
}
else
{
content = $$"""
public static class {{className}}
{
static readonly {{component.Name}} Single{{component.Name}} = new {{component.Name}}();
public static bool Has{{component.Prefix}}(this global::{{contextPrefix}}.Entity entity)
{
return entity.HasComponent({{index}});
}
public static global::{{contextPrefix}}.Entity Add{{component.Prefix}}(this global::{{contextPrefix}}.Entity entity)
{
entity.AddComponent({{index}}, Single{{component.Name}});
return entity;
}
public static global::{{contextPrefix}}.Entity Replace{{component.Prefix}}(this global::{{contextPrefix}}.Entity entity)
{
entity.ReplaceComponent({{index}}, Single{{component.Name}});
return entity;
}
public static global::{{contextPrefix}}.Entity Remove{{component.Prefix}}(this global::{{contextPrefix}}.Entity entity)
{
entity.RemoveComponent({{index}});
return entity;
}
public static {{component.Name}} Get{{component.Prefix}}(this global::{{contextPrefix}}.Entity entity)
{
return ({{component.Name}})entity.GetComponent({{index}});
}
}
""";
}
spc.AddSource(
GeneratedPath(CombinedNamespace(component.Namespace, className)),
GeneratedFileHeader(GeneratorSource(nameof(EntityExtension))) +
NamespaceDeclaration(component.Namespace, content));
}
}
}
================================================
FILE: gen/Entitas.Generators/Component/ComponentGenerator.EntityIndexExtension.cs
================================================
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
partial class ComponentGenerator
{
static void EntityIndexExtension(SourceProductionContext spc, ContextInitializationMethodDeclaration method, AnalyzerConfigOptionsProvider optionsProvider)
{
if (!EntitasAnalyzerConfigOptions.ComponentEntityIndexExtension(optionsProvider, method.SyntaxTree))
return;
var componentMemberPairs = method.Components
.SelectMany(component => component.Members
.Where(member => member.EntityIndexType != -1)
.Select(member => (Component: component, Member: member)))
.ToImmutableArray();
spc.AddSource(
GeneratedPath($"{method.ContextFullName}EntityIndexExtension"),
GeneratedFileHeader(GeneratorSource(nameof(EntityIndexExtension))) +
NamespaceDeclaration(method.ContextNamespace,
$$"""
public static class {{method.ContextName}}EntityIndexExtension
{{{EntityIndexNames(componentMemberPairs)}}
public static {{method.ContextName}} AddAllEntityIndexes(this {{method.ContextName}} context)
{{{AddEntityIndexes(componentMemberPairs, method)}}
return context;
}
}
""") +
EntityIndexExtensionMethods(componentMemberPairs, method));
static string EntityIndexNames(ImmutableArray<(ComponentDeclaration Component, MemberDeclaration Member)> pairs)
{
return pairs.Length == 0
? string.Empty
: "\n" + string.Join("\n", pairs.Select(static pair =>
{
var indexName = $"{pair.Component.FullPrefix}{pair.Member.Name}";
return $" public const string {indexName} = \"{indexName}\";";
})) + "\n";
}
static string AddEntityIndexes(ImmutableArray<(ComponentDeclaration Component, MemberDeclaration Member)> pairs, ContextInitializationMethodDeclaration method)
{
return pairs.Length == 0
? string.Empty
: "\n" + string.Join("\n", pairs.Select(pair =>
{
var indexName = $"{pair.Component.FullPrefix}{pair.Member.Name}";
var indexType = pair.Member.EntityIndexType == 0 ? "EntityIndex" : "PrimaryEntityIndex";
var contextAwareComponentPrefix = pair.Component.ContextAwareComponentPrefix(method.FullContextPrefix);
return $$"""
context.AddEntityIndex(new global::Entitas.{{indexType}}(
{{indexName}},
context.GetGroup(global::{{CombinedNamespace(pair.Component.Namespace, contextAwareComponentPrefix)}}Matcher.{{pair.Component.Prefix}}),
(entity, component) => ((global::{{pair.Component.FullName}})component).{{pair.Member.Name}}));
""";
}));
}
static string EntityIndexExtensionMethods(ImmutableArray<(ComponentDeclaration Component, MemberDeclaration Member)> pairs, ContextInitializationMethodDeclaration method)
{
return pairs.Length == 0
? string.Empty
: "\n" + string.Join("\n", pairs
.GroupBy(pair => pair.Component.Namespace)
.Select(group => NamespaceDeclaration(group.Key,
$$"""
public static class EntityIndexExtension
{
{{string.Join("\n\n", group.Select(pair => pair.Member.EntityIndexType == 0
? $$"""
public static global::System.Collections.Generic.HashSet GetEntitiesWith{{pair.Component.Prefix}}{{pair.Member.Name}}(this global::{{method.ContextFullName}} context, {{pair.Member.Type}} {{pair.Member.ValidLowerFirstName}})
{
return ((global::Entitas.EntityIndex)context.GetEntityIndex(global::{{method.ContextFullName}}EntityIndexExtension.{{pair.Component.FullPrefix}}{{pair.Member.Name}})).GetEntities({{pair.Member.ValidLowerFirstName}});
}
"""
: $$"""
public static global::{{method.FullContextPrefix}}.Entity GetEntityWith{{pair.Component.Prefix}}{{pair.Member.Name}}(this global::{{method.ContextFullName}} context, {{pair.Member.Type}} {{pair.Member.ValidLowerFirstName}})
{
return ((global::Entitas.PrimaryEntityIndex)context.GetEntityIndex(global::{{method.ContextFullName}}EntityIndexExtension.{{pair.Component.FullPrefix}}{{pair.Member.Name}})).GetEntity({{pair.Member.ValidLowerFirstName}});
}
"""))}}
}
"""
)));
}
}
}
}
================================================
FILE: gen/Entitas.Generators/Component/ComponentGenerator.EventSystems.cs
================================================
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
partial class ComponentGenerator
{
static void EventSystemsContextExtension(SourceProductionContext spc, ContextInitializationMethodDeclaration method, AnalyzerConfigOptionsProvider optionsProvider)
{
if (!EntitasAnalyzerConfigOptions.ComponentEventSystemsContextExtension(optionsProvider, method.SyntaxTree))
return;
spc.AddSource(
GeneratedPath($"{method.ContextFullName}EventSystemsExtension"),
GeneratedFileHeader(GeneratorSource(nameof(EventSystemsContextExtension))) +
NamespaceDeclaration(method.ContextNamespace,
$$"""
public static class {{method.ContextName}}EventSystemsExtension
{
public static global::Entitas.Systems CreateEventSystems(this {{method.ContextName}} context)
{
{{AddEventSystems(method.Components, method.FullContextPrefix)}}
}
}
"""));
static string AddEventSystems(ImmutableArray components, string contextPrefix)
{
var events = components
.SelectMany(component => component.Events.Select(@event => (Component: component, Event: @event)))
.ToImmutableArray();
return events.Length == 0
? " return null;"
: $$"""
var systems = new global::Entitas.Systems();
{{string.Join("\n", events
.OrderBy(pair => pair.Event.Order)
.Select(pair =>
{
var (component, @event) = pair;
@event.ContextAware(ContextAware(contextPrefix));
return $" systems.Add(new global::{CombinedNamespace(component.Namespace, @event.ContextAwareEvent)}EventSystem(context)); // Order: {@event.Order}";
}))}}
return systems;
""";
}
}
}
}
================================================
FILE: gen/Entitas.Generators/Component/ComponentGenerator.Events.cs
================================================
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
partial class ComponentGenerator
{
static void Events(SourceProductionContext spc, ComponentDeclaration component, string context, AnalyzerConfigOptionsProvider optionsProvider)
{
if (component.Events.Length == 0)
return;
if (!EntitasAnalyzerConfigOptions.ComponentEvents(optionsProvider, component.SyntaxTree))
return;
var contextPrefix = ContextPrefix(context);
var contextAware = ContextAware(contextPrefix);
var contextAwareComponentPrefix = component.ContextAwareComponentPrefix(contextPrefix);
foreach (var @event in component.Events)
{
@event.ContextAware(contextAware);
var optionalComponentMethodParams = string.Empty;
var optionalComponentValueMethodArgs = string.Empty;
var componentDeclaration = string.Empty;
string filter;
if (@event.EventType == 0)
{
if (component.Members.Length > 0)
{
optionalComponentMethodParams = $", {ComponentMethodParams(component)}";
optionalComponentValueMethodArgs = $", {ComponentValueMethodArgs(component)}";
componentDeclaration = $"\n var component = entity.Get{component.Prefix}();";
}
filter = $"entity.Has{component.Prefix}()";
}
else
{
filter = $"!entity.Has{component.Prefix}()";
}
if (@event.EventTarget == 1)
{
filter += $" && entity.Has{@event.EventListener}()";
}
var content = $$"""
public interface {{@event.ContextAwareEventListenerInterface}}
{
void {{@event.EventMethod}}(global::{{contextPrefix}}.Entity entity{{optionalComponentMethodParams}});
}
public sealed class {{@event.ContextAwareEventListenerComponent}} : global::Entitas.IComponent
{
public global::System.Collections.Generic.List<{{@event.ContextAwareEventListenerInterface}}> Value;
}
public static class {{@event.ContextAwareEventListener}}EventEntityExtension
{
public static global::{{contextPrefix}}.Entity Add{{@event.EventListener}}(this global::{{contextPrefix}}.Entity entity, {{@event.ContextAwareEventListenerInterface}} value)
{
var listeners = entity.Has{{@event.EventListener}}()
? entity.Get{{@event.EventListener}}().Value
: new global::System.Collections.Generic.List<{{@event.ContextAwareEventListenerInterface}}>();
listeners.Add(value);
return entity.Replace{{@event.EventListener}}(listeners);
}
public static void Remove{{@event.EventListener}}(this global::{{contextPrefix}}.Entity entity, {{@event.ContextAwareEventListenerInterface}} value, bool removeListenerWhenEmpty = true)
{
var listeners = entity.Get{{@event.EventListener}}().Value;
listeners.Remove(value);
if (removeListenerWhenEmpty && listeners.Count == 0)
{
entity.Remove{{@event.EventListener}}();
if (entity.IsEmpty())
entity.Destroy();
}
else
{
entity.Replace{{@event.EventListener}}(listeners);
}
}
}
""";
if (@event.EventTarget == 0)
{
content += $$"""
public sealed class {{@event.ContextAwareEvent}}EventSystem : global::Entitas.ReactiveSystem
{
readonly global::Entitas.IGroup _listeners;
readonly global::System.Collections.Generic.List _entityBuffer;
readonly global::System.Collections.Generic.List<{{@event.ContextAwareEventListenerInterface}}> _listenerBuffer;
public {{@event.ContextAwareEvent}}EventSystem({{context}} context) : base(context)
{
_listeners = context.GetGroup({{@event.ContextAwareEventListener}}Matcher.{{@event.EventListener}});
_entityBuffer = new global::System.Collections.Generic.List();
_listenerBuffer = new global::System.Collections.Generic.List<{{@event.ContextAwareEventListenerInterface}}>();
}
protected override global::Entitas.ICollector GetTrigger(global::Entitas.IContext context)
{
return global::Entitas.CollectorContextExtension.CreateCollector(
context, global::Entitas.TriggerOnEventMatcherExtension.{{@event.EventTypeSuffix}}({{contextAwareComponentPrefix}}Matcher.{{component.Prefix}})
);
}
protected override bool Filter(global::{{contextPrefix}}.Entity entity)
{
return {{filter}};
}
protected override void Execute(global::System.Collections.Generic.List entities)
{
foreach (var entity in entities)
{{{componentDeclaration}}
foreach (var listenerEntity in _listeners.GetEntities(_entityBuffer))
{
_listenerBuffer.Clear();
_listenerBuffer.AddRange(listenerEntity.Get{{@event.EventListener}}().Value);
foreach (var listener in _listenerBuffer)
{
listener.{{@event.EventMethod}}(entity{{optionalComponentValueMethodArgs}});
}
}
}
}
}
""";
}
else
{
content += $$"""
public sealed class {{@event.ContextAwareEvent}}EventSystem : global::Entitas.ReactiveSystem
{
readonly global::System.Collections.Generic.List<{{@event.ContextAwareEventListenerInterface}}> _listenerBuffer;
public {{@event.ContextAwareEvent}}EventSystem({{context}} context) : base(context)
{
_listenerBuffer = new global::System.Collections.Generic.List<{{@event.ContextAwareEventListenerInterface}}>();
}
protected override global::Entitas.ICollector GetTrigger(global::Entitas.IContext context)
{
return global::Entitas.CollectorContextExtension.CreateCollector(
context, global::Entitas.TriggerOnEventMatcherExtension.{{@event.EventTypeSuffix}}({{contextAwareComponentPrefix}}Matcher.{{component.Prefix}})
);
}
protected override bool Filter(global::{{contextPrefix}}.Entity entity)
{
return {{filter}};
}
protected override void Execute(global::System.Collections.Generic.List entities)
{
foreach (var entity in entities)
{{{componentDeclaration}}
_listenerBuffer.Clear();
_listenerBuffer.AddRange(entity.Get{{@event.EventListener}}().Value);
foreach (var listener in _listenerBuffer)
{
listener.{{@event.EventMethod}}(entity{{optionalComponentValueMethodArgs}});
}
}
}
}
""";
}
spc.AddSource(
GeneratedPath(CombinedNamespace(component.Namespace, @event.ContextAwareEventListenerComponent)),
GeneratedFileHeader(GeneratorSource(nameof(Events))) +
NamespaceDeclaration(component.Namespace, content));
var eventComponent = ToEvent(component, @event);
ComponentIndex(spc, eventComponent, context, optionsProvider);
Matcher(spc, eventComponent, context, optionsProvider);
EntityExtension(spc, eventComponent, context, optionsProvider);
}
}
}
}
================================================
FILE: gen/Entitas.Generators/Component/ComponentGenerator.Matcher.cs
================================================
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
partial class ComponentGenerator
{
static void Matcher(SourceProductionContext spc, ComponentDeclaration component, string context, AnalyzerConfigOptionsProvider optionsProvider)
{
if (!EntitasAnalyzerConfigOptions.ComponentMatcher(optionsProvider, component.SyntaxTree))
return;
var contextPrefix = ContextPrefix(context);
var contextAwareComponentPrefix = component.ContextAwareComponentPrefix(contextPrefix);
var className = $"{contextAwareComponentPrefix}Matcher";
var index = $"{contextAwareComponentPrefix}ComponentIndex.Index.Value";
spc.AddSource(
GeneratedPath(CombinedNamespace(component.Namespace, className)),
GeneratedFileHeader(GeneratorSource(nameof(Matcher))) +
NamespaceDeclaration(component.Namespace,
$$"""
public static class {{className}}
{
static global::Entitas.IMatcher _matcher;
public static global::Entitas.IMatcher {{component.Prefix}}
{
get
{
if (_matcher == null)
{
var matcher = (global::Entitas.Matcher)global::Entitas.Matcher.AllOf({{index}});
matcher.ComponentNames = {{context}}.ComponentNames;
_matcher = matcher;
}
return _matcher;
}
}
}
"""));
}
}
}
================================================
FILE: gen/Entitas.Generators/Component/ComponentGenerator.cs
================================================
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
[Generator(LanguageNames.CSharp)]
public sealed partial class ComponentGenerator : IIncrementalGenerator
{
public void Initialize(IncrementalGeneratorInitializationContext initContext)
{
var optionsProvider = initContext.AnalyzerConfigOptionsProvider;
var componentsProvider = initContext.SyntaxProvider
.CreateSyntaxProvider(IsComponentCandidate, CreateComponentDeclaration)
.Where(static component => component is not null)
.Select(static (component, _) => component!.Value);
initContext.RegisterSourceOutput(
componentsProvider.WithComparer(FullNameAndContextsComparer.Instance).Combine(optionsProvider),
static (SourceProductionContext spc, (ComponentDeclaration Component, AnalyzerConfigOptionsProvider OptionsProvider) pair) =>
{
foreach (var context in pair.Component.Contexts)
{
spc.CancellationToken.ThrowIfCancellationRequested();
ComponentIndex(spc, pair.Component, context, pair.OptionsProvider);
Matcher(spc, pair.Component, context, pair.OptionsProvider);
}
});
initContext.RegisterSourceOutput(
componentsProvider.WithComparer(new FullNameAndMembersAndContextsComparer(TypeAndNameComparer.Instance)).Combine(optionsProvider),
static (SourceProductionContext spc, (ComponentDeclaration Component, AnalyzerConfigOptionsProvider OptionsProvider) pair) =>
{
foreach (var context in pair.Component.Contexts)
{
spc.CancellationToken.ThrowIfCancellationRequested();
EntityExtension(spc, pair.Component, context, pair.OptionsProvider);
}
});
initContext.RegisterSourceOutput(
componentsProvider.WithComparer(new FullNameAndMembersAndContextsAndIsUniqueComparer(TypeAndNameComparer.Instance)).Combine(optionsProvider),
static (SourceProductionContext spc, (ComponentDeclaration Component, AnalyzerConfigOptionsProvider OptionsProvider) pair) =>
{
foreach (var context in pair.Component.Contexts)
{
spc.CancellationToken.ThrowIfCancellationRequested();
ContextExtension(spc, pair.Component, context, pair.OptionsProvider);
}
});
initContext.RegisterSourceOutput(
componentsProvider.WithComparer(FullNameAndContextsAndCleanupModeComparer.Instance).Combine(optionsProvider),
static (SourceProductionContext spc, (ComponentDeclaration Component, AnalyzerConfigOptionsProvider OptionsProvider) pair) =>
{
foreach (var context in pair.Component.Contexts)
{
spc.CancellationToken.ThrowIfCancellationRequested();
CleanupSystem(spc, pair.Component, context, pair.OptionsProvider);
}
});
initContext.RegisterSourceOutput(
componentsProvider.WithComparer(new FullNameAndMembersAndContextsAndEventsComparer(TypeAndNameComparer.Instance, EventTargetAndEventTypeComparer.Instance)).Combine(optionsProvider),
static (SourceProductionContext spc, (ComponentDeclaration Component, AnalyzerConfigOptionsProvider OptionsProvider) pair) =>
{
foreach (var context in pair.Component.Contexts)
{
spc.CancellationToken.ThrowIfCancellationRequested();
Events(spc, pair.Component, context, pair.OptionsProvider);
}
});
var componentsInCompilationProvider = initContext.CompilationProvider.Select(CreateComponentDeclarationsForCompilation);
var contextInitializationProvider = initContext.SyntaxProvider
.CreateSyntaxProvider(IsContextInitializationMethodCandidate, CreateContextInitializationMethodDeclaration)
.Where(static method => method is not null)
.Select(static (method, _) => method!.Value)
.WithComparer(NamespaceAndClassAndNameAndContextFullNameComparer.Instance);
var contextInitializationMethodComparer = new FullNameAndContextsAndEventsComparer(EventTargetAndEventTypeComparer.Instance);
initContext.RegisterImplementationSourceOutput(contextInitializationProvider
.Combine(componentsInCompilationProvider.WithComparer(new ComponentsComparer(contextInitializationMethodComparer)))
.Select(static ((ContextInitializationMethodDeclaration Method, ImmutableArray Components) pair, CancellationToken _) =>
{
pair.Method.Components = pair.Components
.Where(component => component.Contexts.Contains(pair.Method.ContextFullName))
.ToImmutableArray();
return pair.Method;
})
.WithComparer(new NamespaceAndClassAndNameAndContextFullNameAndComponentsComparer(contextInitializationMethodComparer))
.Combine(optionsProvider),
static (SourceProductionContext spc, (ContextInitializationMethodDeclaration Method, AnalyzerConfigOptionsProvider OptionsProvider) pair) =>
ContextInitializationMethod(spc, pair.Method, pair.OptionsProvider));
var cleanupSystemsComparer = FullNameAndContextsAndCleanupModeComparer.Instance;
initContext.RegisterSourceOutput(contextInitializationProvider
.Combine(componentsInCompilationProvider.WithComparer(new ComponentsComparer(cleanupSystemsComparer)))
.Select(static ((ContextInitializationMethodDeclaration Method, ImmutableArray Components) pair, CancellationToken _) =>
{
pair.Method.Components = pair.Components
.Where(static component => component.CleanupMode != -1)
.Where(component => component.Contexts.Contains(pair.Method.ContextFullName))
.ToImmutableArray();
return pair.Method;
})
.WithComparer(new NamespaceAndClassAndNameAndContextFullNameAndComponentsComparer(cleanupSystemsComparer))
.Combine(optionsProvider),
static (SourceProductionContext spc, (ContextInitializationMethodDeclaration Method, AnalyzerConfigOptionsProvider OptionsProvider) pair) =>
CleanupSystems(spc, pair.Method, pair.OptionsProvider));
var eventSystemsContextExtensionComparer = new FullNameAndContextsAndEventsComparer(EventTargetAndEventTypeAndOrderComparer.Instance);
initContext.RegisterSourceOutput(contextInitializationProvider
.Combine(componentsInCompilationProvider.WithComparer(new ComponentsComparer(eventSystemsContextExtensionComparer)))
.Select(static ((ContextInitializationMethodDeclaration Method, ImmutableArray Components) pair, CancellationToken _) =>
{
pair.Method.Components = pair.Components
.Where(component => component.Events.Length > 0)
.Where(component => component.Contexts.Contains(pair.Method.ContextFullName))
.ToImmutableArray();
return pair.Method;
})
.WithComparer(new NamespaceAndClassAndNameAndContextFullNameAndComponentsComparer(eventSystemsContextExtensionComparer))
.Combine(optionsProvider),
static (SourceProductionContext spc, (ContextInitializationMethodDeclaration Method, AnalyzerConfigOptionsProvider OptionsProvider) pair) =>
EventSystemsContextExtension(spc, pair.Method, pair.OptionsProvider));
var entityIndexExtensionComparer = new FullNameAndMembersAndContextsComparer(TypeAndNameAndEntityIndexTypeComparer.Instance);
initContext.RegisterSourceOutput(contextInitializationProvider
.Combine(componentsInCompilationProvider.WithComparer(new ComponentsComparer(entityIndexExtensionComparer)))
.Select(static ((ContextInitializationMethodDeclaration Method, ImmutableArray Components) pair, CancellationToken _) =>
{
pair.Method.Components = pair.Components
.Where(static component => component.Members.Any(static member => member.EntityIndexType != -1))
.Where(component => component.Contexts.Contains(pair.Method.ContextFullName))
.ToImmutableArray();
return pair.Method;
})
.WithComparer(new NamespaceAndClassAndNameAndContextFullNameAndComponentsComparer(entityIndexExtensionComparer))
.Combine(optionsProvider),
static (SourceProductionContext spc, (ContextInitializationMethodDeclaration Method, AnalyzerConfigOptionsProvider OptionsProvider) pair) =>
EntityIndexExtension(spc, pair.Method, pair.OptionsProvider));
}
static bool IsComponentCandidate(SyntaxNode node, CancellationToken _)
{
return node is ClassDeclarationSyntax { BaseList.Types.Count: > 0 } candidate
&& candidate.BaseList.Types.Any(static baseType => baseType.Type switch
{
IdentifierNameSyntax identifierNameSyntax => identifierNameSyntax.Identifier is { Text: "IComponent" },
QualifiedNameSyntax qualifiedNameSyntax => qualifiedNameSyntax is
{
Left: IdentifierNameSyntax { Identifier.Text: "Entitas" },
Right: IdentifierNameSyntax { Identifier.Text: "IComponent" }
},
_ => false
})
&& candidate.Modifiers.Any(SyntaxKind.PublicKeyword)
&& !candidate.Modifiers.Any(SyntaxKind.StaticKeyword)
&& candidate.Modifiers.Any(SyntaxKind.SealedKeyword)
&& !candidate.Modifiers.Any(SyntaxKind.PartialKeyword);
}
static ComponentDeclaration? CreateComponentDeclaration(GeneratorSyntaxContext syntaxContext, CancellationToken cancellationToken)
{
var candidate = (ClassDeclarationSyntax)syntaxContext.Node;
var symbol = syntaxContext.SemanticModel.GetDeclaredSymbol(candidate, cancellationToken);
if (symbol is null)
return null;
var componentInterface = syntaxContext.SemanticModel.Compilation.GetTypeByMetadataName("Entitas.IComponent");
if (componentInterface is null)
return null;
var isComponent = symbol.Interfaces.Contains(componentInterface);
if (!isComponent)
return null;
var contexts = GetContexts(symbol);
if (contexts.Length == 0)
return null;
return new ComponentDeclaration(candidate.SyntaxTree, symbol, contexts);
}
static ImmutableArray CreateComponentDeclarationsForCompilation(Compilation compilation, CancellationToken cancellationToken)
{
var componentInterface = compilation.GetTypeByMetadataName("Entitas.IComponent");
if (componentInterface is null)
return ImmutableArray.Empty;
var allComponents = new List();
var stack = new Stack();
stack.Push(compilation.GlobalNamespace);
while (stack.Count > 0)
{
cancellationToken.ThrowIfCancellationRequested();
foreach (var member in stack.Pop().GetMembers())
{
cancellationToken.ThrowIfCancellationRequested();
if (member is INamespaceSymbol ns)
{
stack.Push(ns);
}
else if (member is INamedTypeSymbol symbol)
{
var isComponent = symbol.Interfaces.Contains(componentInterface);
if (!isComponent)
continue;
var contexts = GetContexts(symbol);
if (contexts.Length == 0)
continue;
var component = new ComponentDeclaration(symbol.DeclaringSyntaxReferences.FirstOrDefault()?.SyntaxTree, symbol, contexts);
allComponents.Add(component);
foreach (var context in contexts)
{
var contextAware = ContextAware(ContextPrefix(context));
foreach (var @event in component.Events)
{
@event.ContextAware(contextAware);
allComponents.Add(ToEvent(component, @event));
}
}
}
}
}
return allComponents
.OrderBy(static component => component.FullName)
.ToImmutableArray();
}
static ImmutableArray GetContexts(INamedTypeSymbol symbol)
{
return symbol.GetAttributes()
.Where(static attribute => attribute.AttributeClass?.ToDisplayString() == "Entitas.Generators.Attributes.ContextAttribute")
.Select(static attribute => attribute.ConstructorArguments.SingleOrDefault())
.Where(static arg => arg.Type?.ToDisplayString() == "System.Type" && arg.Value is INamedTypeSymbol)
.Select(static arg => ((INamedTypeSymbol)arg.Value!).ToDisplayString())
.Distinct()
.ToImmutableArray();
}
static bool IsContextInitializationMethodCandidate(SyntaxNode node, CancellationToken _)
{
return node is MethodDeclarationSyntax { AttributeLists.Count: > 0 } candidate
&& candidate.AttributeLists.Any(static attributeList => attributeList.Attributes
.Any(static attribute => attribute.Name is IdentifierNameSyntax { Identifier.Text: "ContextInitialization" or "ContextInitializationAttribute" }))
&& candidate.Modifiers.Any(SyntaxKind.PublicKeyword)
&& candidate.Modifiers.Any(SyntaxKind.StaticKeyword)
&& candidate.Modifiers.Any(SyntaxKind.PartialKeyword)
&& candidate.ReturnType is PredefinedTypeSyntax predefined
&& predefined.Keyword.IsKind(SyntaxKind.VoidKeyword);
}
static ContextInitializationMethodDeclaration? CreateContextInitializationMethodDeclaration(GeneratorSyntaxContext syntaxContext, CancellationToken cancellationToken)
{
var candidate = (MethodDeclarationSyntax)syntaxContext.Node;
var symbol = syntaxContext.SemanticModel.GetDeclaredSymbol(candidate, cancellationToken);
if (symbol is null)
return null;
if (!symbol.ContainingType.IsStatic || symbol.ContainingType.DeclaredAccessibility != Accessibility.Public)
return null;
var context = symbol.GetAttributes()
.Where(static attribute => attribute.AttributeClass?.ToDisplayString() == "Entitas.Generators.Attributes.ContextInitializationAttribute")
.Select(static attribute => attribute.ConstructorArguments.SingleOrDefault())
.Where(static arg => arg.Type?.ToDisplayString() == "System.Type" && arg.Value is INamedTypeSymbol)
.Select(static arg => (INamedTypeSymbol)arg.Value!)
.Distinct(SymbolEqualityComparer.Default)
.SingleOrDefault();
if (context is null)
return null;
return new ContextInitializationMethodDeclaration(candidate.SyntaxTree, symbol, context);
}
static ComponentDeclaration ToEvent(ComponentDeclaration component, EventDeclaration @event) => component.ToEvent(
CombinedNamespace(component.Namespace, @event.ContextAwareEventListenerComponent),
@event.ContextAwareEventListenerComponent,
ImmutableArray.Create(new MemberDeclaration($"global::System.Collections.Generic.List<{@event.ContextAwareEventListenerInterface}>", "Value", -1)),
@event.EventListener);
static string GeneratorSource(string source) => $"{typeof(ComponentGenerator).FullName}.{source}";
}
}
================================================
FILE: gen/Entitas.Generators/Component/ContextInitializationMethodDeclaration.cs
================================================
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
namespace Entitas.Generators
{
public struct ContextInitializationMethodDeclaration
{
public readonly SyntaxTree SyntaxTree;
public readonly string? Namespace;
public readonly string Class;
public readonly string Name;
public readonly string? ContextNamespace;
public readonly string ContextFullName;
public readonly string ContextName;
public readonly string FullContextPrefix;
public ImmutableArray Components;
public ContextInitializationMethodDeclaration(SyntaxTree syntaxTree, IMethodSymbol symbol, ISymbol contextSymbol)
{
SyntaxTree = syntaxTree;
Namespace = !symbol.ContainingNamespace.IsGlobalNamespace
? symbol.ContainingNamespace.ToDisplayString()
: null;
Class = symbol.ContainingType.Name;
Name = symbol.Name;
ContextNamespace = !contextSymbol.ContainingNamespace.IsGlobalNamespace
? symbol.ContainingNamespace.ToDisplayString()
: null;
ContextFullName = contextSymbol.ToDisplayString();
ContextName = contextSymbol.Name;
FullContextPrefix = ContextFullName.RemoveSuffix("Context");
}
}
public class NamespaceAndClassAndNameAndContextFullNameComparer : IEqualityComparer
{
public static readonly NamespaceAndClassAndNameAndContextFullNameComparer Instance = new NamespaceAndClassAndNameAndContextFullNameComparer();
public bool Equals(ContextInitializationMethodDeclaration x, ContextInitializationMethodDeclaration y) =>
x.Namespace == y.Namespace &&
x.Class == y.Class &&
x.Name == y.Name &&
x.ContextFullName == y.ContextFullName;
public int GetHashCode(ContextInitializationMethodDeclaration obj)
{
unchecked
{
var hashCode = obj.Namespace != null ? obj.Namespace.GetHashCode() : 0;
hashCode = (hashCode * 397) ^ obj.Class.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Name.GetHashCode();
hashCode = (hashCode * 397) ^ obj.ContextFullName.GetHashCode();
return hashCode;
}
}
}
public class NamespaceAndClassAndNameAndContextFullNameAndComponentsComparer : IEqualityComparer
{
readonly IEqualityComparer _componentComparer;
public NamespaceAndClassAndNameAndContextFullNameAndComponentsComparer(IEqualityComparer componentComparer)
{
_componentComparer = componentComparer;
}
public bool Equals(ContextInitializationMethodDeclaration x, ContextInitializationMethodDeclaration y) =>
x.Namespace == y.Namespace &&
x.Class == y.Class &&
x.Name == y.Name &&
x.ContextFullName == y.ContextFullName &&
x.Components.SequenceEqual(y.Components, _componentComparer);
public int GetHashCode(ContextInitializationMethodDeclaration obj)
{
unchecked
{
var hashCode = (obj.Namespace != null ? obj.Namespace.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ obj.Class.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Name.GetHashCode();
hashCode = (hashCode * 397) ^ obj.ContextFullName.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Components.GetHashCode();
return hashCode;
}
}
}
}
================================================
FILE: gen/Entitas.Generators/Component/EventDeclaration.cs
================================================
using System.Collections.Generic;
namespace Entitas.Generators
{
public struct EventDeclaration
{
public readonly int EventTarget;
public readonly int EventType;
public readonly int Order;
public readonly string EventTargetPrefix;
public readonly string EventTypeSuffix;
public readonly string EventPrefix;
public readonly string EventListener;
public readonly string EventMethod;
public string ContextAwareEvent = null!;
public string ContextAwareEventListener = null!;
public string ContextAwareEventListenerInterface = null!;
public string ContextAwareEventListenerComponent = null!;
public EventDeclaration(int eventTarget, int eventType, int order, string componentPrefix)
{
EventTarget = eventTarget;
EventType = eventType;
Order = order;
EventTargetPrefix = eventTarget == 0 ? "Any" : string.Empty;
EventTypeSuffix = eventType == 0 ? "Added" : "Removed";
EventPrefix = $"{EventTargetPrefix}{componentPrefix}{EventTypeSuffix}"; // e.g. AnyPositionAdded
EventListener = $"{EventPrefix}Listener"; // e.g. AnyPositionAddedListener
EventMethod = $"On{EventPrefix}"; // e.g. OnAnyPositionAdded
}
public void ContextAware(string contextAware)
{
ContextAwareEvent = $"{contextAware}{EventPrefix}"; // e.g. MyAppMainAnyPositionAdded
ContextAwareEventListener = $"{ContextAwareEvent}Listener"; // e.g. MyAppMainAnyPositionAddedListener
ContextAwareEventListenerInterface = $"I{ContextAwareEventListener}"; // e.g. IMyAppMainAnyPositionAddedListener
ContextAwareEventListenerComponent = $"{ContextAwareEventListener}Component"; // e.g. MyAppMainAnyPositionAddedListenerComponent
}
}
public class EventTargetAndEventTypeComparer : IEqualityComparer
{
public static readonly EventTargetAndEventTypeComparer Instance = new EventTargetAndEventTypeComparer();
public bool Equals(EventDeclaration x, EventDeclaration y) =>
x.EventTarget == y.EventTarget &&
x.EventType == y.EventType;
public int GetHashCode(EventDeclaration obj)
{
unchecked
{
var hashCode = obj.EventTarget.GetHashCode();
hashCode = (hashCode * 397) ^ obj.EventType.GetHashCode();
return hashCode;
}
}
}
public class EventTargetAndEventTypeAndOrderComparer : IEqualityComparer
{
public static readonly EventTargetAndEventTypeAndOrderComparer Instance = new EventTargetAndEventTypeAndOrderComparer();
public bool Equals(EventDeclaration x, EventDeclaration y) =>
x.EventTarget == y.EventTarget &&
x.EventType == y.EventType &&
x.Order == y.Order;
public int GetHashCode(EventDeclaration obj)
{
unchecked
{
var hashCode = obj.EventTarget.GetHashCode();
hashCode = (hashCode * 397) ^ obj.EventType.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Order.GetHashCode();
return hashCode;
}
}
}
}
================================================
FILE: gen/Entitas.Generators/Component/MemberDeclaration.cs
================================================
using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
namespace Entitas.Generators
{
public readonly struct MemberDeclaration
{
public readonly string Type;
public readonly string Name;
public readonly int EntityIndexType;
public readonly string ValidLowerFirstName;
public MemberDeclaration(IFieldSymbol field) : this(field, field.Type) { }
public MemberDeclaration(IPropertySymbol property) : this(property, property.Type) { }
public MemberDeclaration(ISymbol symbol, ITypeSymbol type) : this(GetTypeName(type), symbol.Name, GetEntityIndexType(symbol)) { }
public MemberDeclaration(string type, string name, int entityIndexType)
{
Type = type;
Name = name;
EntityIndexType = entityIndexType;
ValidLowerFirstName = ToValidLowerFirst(Name);
}
static string GetTypeName(ITypeSymbol type)
{
return type is IArrayTypeSymbol arrayType
? arrayType.ToDisplayString().Replace("*", string.Empty)
: type.ToDisplayString();
}
static int GetEntityIndexType(ISymbol symbol)
{
var attribute = symbol.GetAttributes().FirstOrDefault(static attribute => attribute.AttributeClass?.ToDisplayString() == "Entitas.Generators.Attributes.EntityIndexAttribute");
if (attribute is null)
return -1;
var arg = attribute.ConstructorArguments.FirstOrDefault();
return arg.Type?.ToDisplayString() == "bool" && arg.Value is bool isPrimary ? isPrimary ? 1 : 0 : -1;
}
static string ToValidLowerFirst(string value)
{
var lowerFirst = char.ToLower(value[0]) + value.Substring(1);
return SyntaxFacts.GetKeywordKind(lowerFirst) != SyntaxKind.None
? $"@{lowerFirst}"
: lowerFirst;
}
}
public class TypeAndNameComparer : IEqualityComparer
{
public static readonly TypeAndNameComparer Instance = new TypeAndNameComparer();
public bool Equals(MemberDeclaration x, MemberDeclaration y) =>
x.Type == y.Type &&
x.Name == y.Name;
public int GetHashCode(MemberDeclaration obj)
{
unchecked
{
return (obj.Type.GetHashCode() * 397) ^ obj.Name.GetHashCode();
}
}
}
public class TypeAndNameAndEntityIndexTypeComparer : IEqualityComparer
{
public static readonly TypeAndNameAndEntityIndexTypeComparer Instance = new TypeAndNameAndEntityIndexTypeComparer();
public bool Equals(MemberDeclaration x, MemberDeclaration y) =>
x.Type == y.Type &&
x.Name == y.Name &&
x.EntityIndexType == y.EntityIndexType;
public int GetHashCode(MemberDeclaration obj)
{
unchecked
{
var hashCode = obj.Type.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Name.GetHashCode();
hashCode = (hashCode * 397) ^ obj.EntityIndexType;
return hashCode;
}
}
}
}
================================================
FILE: gen/Entitas.Generators/Context/ContextDeclaration.cs
================================================
using System;
using Microsoft.CodeAnalysis;
namespace Entitas.Generators
{
public readonly struct ContextDeclaration : IEquatable
{
public readonly SyntaxTree SyntaxTree;
public readonly string? Namespace;
public readonly string FullName;
public readonly string Name;
public readonly string FullContextPrefix;
public readonly string ContextPrefix;
public ContextDeclaration(SyntaxTree syntaxTree, INamedTypeSymbol symbol)
{
SyntaxTree = syntaxTree;
Namespace = !symbol.ContainingNamespace.IsGlobalNamespace ? symbol.ContainingNamespace.ToDisplayString() : null;
FullName = symbol.ToDisplayString();
Name = symbol.Name;
FullContextPrefix = FullName.RemoveSuffix("Context");
ContextPrefix = Name.RemoveSuffix("Context");
}
public bool Equals(ContextDeclaration other) => FullName == other.FullName;
public override bool Equals(object? obj) => obj is ContextDeclaration other && Equals(other);
public override int GetHashCode() => FullName.GetHashCode();
}
}
================================================
FILE: gen/Entitas.Generators/Context/ContextGenerator.ComponentIndex.cs
================================================
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
partial class ContextGenerator
{
static void ComponentIndex(SourceProductionContext spc, ContextDeclaration context, AnalyzerConfigOptionsProvider optionsProvider)
{
if (!EntitasAnalyzerConfigOptions.ContextComponentIndex(optionsProvider, context.SyntaxTree))
return;
spc.AddSource(ContextAwarePath(context, "ComponentIndex"),
GeneratedFileHeader(GeneratorSource(nameof(ComponentIndex))) +
NamespaceDeclaration(context.FullContextPrefix,
"""
public readonly struct ComponentIndex : global::System.IEquatable
{
public readonly int Value;
public ComponentIndex(int value)
{
Value = value;
}
public bool Equals(ComponentIndex other) => Value == other.Value;
#nullable enable
public override bool Equals(object? obj) => obj is ComponentIndex other && Equals(other);
#nullable disable
public override int GetHashCode() => Value;
}
"""));
}
}
}
================================================
FILE: gen/Entitas.Generators/Context/ContextGenerator.Context.cs
================================================
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
partial class ContextGenerator
{
static void Context(SourceProductionContext spc, ContextDeclaration context, AnalyzerConfigOptionsProvider optionsProvider)
{
if (!EntitasAnalyzerConfigOptions.ContextContext(optionsProvider, context.SyntaxTree))
return;
spc.AddSource(GeneratedPath(context.FullName),
GeneratedFileHeader(GeneratorSource(nameof(Context))) +
NamespaceDeclaration(context.Namespace,
$$"""
public sealed partial class {{context.Name}} : global::Entitas.Context<{{context.ContextPrefix}}.Entity>
{
public static string[] ComponentNames;
public static global::System.Type[] ComponentTypes;
public {{context.Name}}() :
base(
ComponentTypes.Length,
0,
new global::Entitas.ContextInfo(
"{{context.FullName}}",
ComponentNames,
ComponentTypes
),
#if (ENTITAS_FAST_AND_UNSAFE)
global::Entitas.UnsafeAERC.Delegate,
#else
global::Entitas.SafeAERC.Delegate,
#endif
() => new {{context.ContextPrefix}}.Entity()
) { }
}
"""));
}
}
}
================================================
FILE: gen/Entitas.Generators/Context/ContextGenerator.Entity.cs
================================================
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
partial class ContextGenerator
{
static void Entity(SourceProductionContext spc, ContextDeclaration context, AnalyzerConfigOptionsProvider optionsProvider)
{
if (!EntitasAnalyzerConfigOptions.ContextEntity(optionsProvider, context.SyntaxTree))
return;
spc.AddSource(ContextAwarePath(context, "Entity"),
GeneratedFileHeader(GeneratorSource(nameof(Entity))) +
NamespaceDeclaration(context.FullContextPrefix,
"""
public sealed class Entity : global::Entitas.Entity { }
"""));
}
}
}
================================================
FILE: gen/Entitas.Generators/Context/ContextGenerator.Matcher.cs
================================================
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
partial class ContextGenerator
{
static void Matcher(SourceProductionContext spc, ContextDeclaration context, AnalyzerConfigOptionsProvider optionsProvider)
{
if (!EntitasAnalyzerConfigOptions.ContextMatcher(optionsProvider, context.SyntaxTree))
return;
spc.AddSource(ContextAwarePath(context, "Matcher"),
GeneratedFileHeader(GeneratorSource(nameof(Matcher))) +
NamespaceDeclaration(context.FullContextPrefix,
"""
public static class Matcher
{
public static global::Entitas.IAllOfMatcher AllOf(params int[] indexes)
{
return global::Entitas.Matcher.AllOf(indexes);
}
public static global::Entitas.IAllOfMatcher AllOf(params global::Entitas.IMatcher[] matchers)
{
return global::Entitas.Matcher.AllOf(matchers);
}
public static global::Entitas.IAnyOfMatcher AnyOf(params int[] indexes)
{
return global::Entitas.Matcher.AnyOf(indexes);
}
public static global::Entitas.IAnyOfMatcher AnyOf(params global::Entitas.IMatcher[] matchers)
{
return global::Entitas.Matcher.AnyOf(matchers);
}
}
"""));
}
}
}
================================================
FILE: gen/Entitas.Generators/Context/ContextGenerator.cs
================================================
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using static Entitas.Generators.Templates;
namespace Entitas.Generators
{
[Generator(LanguageNames.CSharp)]
public sealed partial class ContextGenerator : IIncrementalGenerator
{
public void Initialize(IncrementalGeneratorInitializationContext initContext)
{
var options = initContext.AnalyzerConfigOptionsProvider;
var contextChanged = initContext.SyntaxProvider
.CreateSyntaxProvider(IsContextCandidate, CreateContextDeclaration)
.Where(static context => context is not null)
.Select(static (context, _) => context!.Value);
initContext.RegisterSourceOutput(contextChanged.Combine(options), OnContextChanged);
}
static bool IsContextCandidate(SyntaxNode node, CancellationToken _)
{
return node is ClassDeclarationSyntax { BaseList.Types.Count: > 0 } candidate
&& candidate.BaseList.Types.Any(static baseType => baseType.Type switch
{
IdentifierNameSyntax identifierNameSyntax => identifierNameSyntax.Identifier is { Text: "IContext" },
QualifiedNameSyntax qualifiedNameSyntax => qualifiedNameSyntax is
{
Left: IdentifierNameSyntax { Identifier.Text: "Entitas" },
Right: IdentifierNameSyntax { Identifier.Text: "IContext" }
},
_ => false
})
&& !candidate.Modifiers.Any(SyntaxKind.PublicKeyword)
&& !candidate.Modifiers.Any(SyntaxKind.StaticKeyword)
&& !candidate.Modifiers.Any(SyntaxKind.SealedKeyword)
&& candidate.Modifiers.Any(SyntaxKind.PartialKeyword);
}
static ContextDeclaration? CreateContextDeclaration(GeneratorSyntaxContext syntaxContext, CancellationToken cancellationToken)
{
var candidate = (ClassDeclarationSyntax)syntaxContext.Node;
var symbol = syntaxContext.SemanticModel.GetDeclaredSymbol(candidate, cancellationToken);
if (symbol is null)
return null;
var componentInterface = syntaxContext.SemanticModel.Compilation.GetTypeByMetadataName("Entitas.IContext");
if (componentInterface is null)
return null;
var isContext = symbol.Interfaces.Contains(componentInterface);
if (!isContext)
return null;
return new ContextDeclaration(candidate.SyntaxTree, symbol);
}
static void OnContextChanged(SourceProductionContext spc, (ContextDeclaration Context, AnalyzerConfigOptionsProvider OptionsProvider) pair)
{
var (context, optionsProvider) = pair;
ComponentIndex(spc, context, optionsProvider);
Entity(spc, context, optionsProvider);
Matcher(spc, context, optionsProvider);
Context(spc, context, optionsProvider);
}
static string ContextAwarePath(ContextDeclaration context, string hintName)
{
return GeneratedPath($"{context.FullContextPrefix}.{hintName}");
}
static string GeneratorSource(string source)
{
return $"{typeof(ContextGenerator).FullName}.{source}";
}
}
}
================================================
FILE: gen/Entitas.Generators/Entitas.Generators.csproj
================================================
$(DefaultGeneratorFramework)
2.0.0
enable
true
all
runtime; build; native; contentfiles; analyzers; buildtransitive
================================================
FILE: gen/Entitas.Generators/Entitas.Generators.csproj.DotSettings
================================================
True
True
================================================
FILE: gen/Entitas.Generators/EntitasAnalyzerConfigOptions.cs
================================================
using System;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
namespace Entitas.Generators
{
public static class EntitasAnalyzerConfigOptions
{
public const string ComponentCleanupSystemsKey = "entitas_generator.component.cleanup_systems";
public const string ComponentComponentIndexKey = "entitas_generator.component.component_index";
public const string ComponentContextExtensionKey = "entitas_generator.component.context_extension";
public const string ComponentContextInitializationMethodKey = "entitas_generator.component.context_initialization_method";
public const string ComponentEntityExtensionKey = "entitas_generator.component.entity_extension";
public const string ComponentEntityIndexExtensionKey = "entitas_generator.component.entity_index_extension";
public const string ComponentEventsKey = "entitas_generator.component.events";
public const string ComponentEventSystemsExtensionKey = "entitas_generator.component.event_systems_extension";
public const string ComponentMatcherKey = "entitas_generator.component.matcher";
public const string ContextComponentIndexKey = "entitas_generator.context.component_index";
public const string ContextContextKey = "entitas_generator.context.context";
public const string ContextEntityKey = "entitas_generator.context.entity";
public const string ContextMatcherKey = "entitas_generator.context.matcher";
public static bool ComponentCleanupSystems(AnalyzerConfigOptionsProvider optionsProvider, SyntaxTree? syntaxTree) => IsTrue(optionsProvider, syntaxTree, ComponentCleanupSystemsKey);
public static bool ComponentComponentIndex(AnalyzerConfigOptionsProvider optionsProvider, SyntaxTree? syntaxTree) => IsTrue(optionsProvider, syntaxTree, ComponentComponentIndexKey);
public static bool ComponentContextExtension(AnalyzerConfigOptionsProvider optionsProvider, SyntaxTree? syntaxTree) => IsTrue(optionsProvider, syntaxTree, ComponentContextExtensionKey);
public static bool ComponentContextInitializationMethod(AnalyzerConfigOptionsProvider optionsProvider, SyntaxTree? syntaxTree) => IsTrue(optionsProvider, syntaxTree, ComponentContextInitializationMethodKey);
public static bool ComponentEntityExtension(AnalyzerConfigOptionsProvider optionsProvider, SyntaxTree? syntaxTree) => IsTrue(optionsProvider, syntaxTree, ComponentEntityExtensionKey);
public static bool ComponentEntityIndexExtension(AnalyzerConfigOptionsProvider optionsProvider, SyntaxTree? syntaxTree) => IsTrue(optionsProvider, syntaxTree, ComponentEntityIndexExtensionKey);
public static bool ComponentEvents(AnalyzerConfigOptionsProvider optionsProvider, SyntaxTree? syntaxTree) => IsTrue(optionsProvider, syntaxTree, ComponentEventsKey);
public static bool ComponentEventSystemsContextExtension(AnalyzerConfigOptionsProvider optionsProvider, SyntaxTree? syntaxTree) => IsTrue(optionsProvider, syntaxTree, ComponentEventSystemsExtensionKey);
public static bool ComponentMatcher(AnalyzerConfigOptionsProvider optionsProvider, SyntaxTree? syntaxTree) => IsTrue(optionsProvider, syntaxTree, ComponentMatcherKey);
public static bool ContextComponentIndex(AnalyzerConfigOptionsProvider optionsProvider, SyntaxTree? syntaxTree) => IsTrue(optionsProvider, syntaxTree, ContextComponentIndexKey);
public static bool ContextContext(AnalyzerConfigOptionsProvider optionsProvider, SyntaxTree? syntaxTree) => IsTrue(optionsProvider, syntaxTree, ContextContextKey);
public static bool ContextEntity(AnalyzerConfigOptionsProvider optionsProvider, SyntaxTree? syntaxTree) => IsTrue(optionsProvider, syntaxTree, ContextEntityKey);
public static bool ContextMatcher(AnalyzerConfigOptionsProvider optionsProvider, SyntaxTree? syntaxTree) => IsTrue(optionsProvider, syntaxTree, ContextMatcherKey);
static bool IsTrue(AnalyzerConfigOptionsProvider optionsProvider, SyntaxTree? syntaxTree, string key)
{
return syntaxTree is not null && (!optionsProvider.GetOptions(syntaxTree).TryGetValue(key, out var value) || value.Equals("true", StringComparison.OrdinalIgnoreCase));
}
}
}
================================================
FILE: gen/Entitas.Generators/Templates.cs
================================================
using System;
using System.Linq;
namespace Entitas.Generators
{
public static class Templates
{
public static string GeneratedPath(string hintName)
{
return $"{hintName}.g.cs";
}
public static string GeneratedFileHeader(string generatorSource)
{
return $$"""
//------------------------------------------------------------------------------
//
// This code was generated by
// {{generatorSource}}
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
""";
}
public static string CombinedNamespace(string? @namespace, string suffix)
{
return !string.IsNullOrEmpty(@namespace)
? $"{@namespace}.{suffix}"
: suffix;
}
public static string NamespaceDeclaration(string? @namespace, string content)
{
return !string.IsNullOrEmpty(@namespace)
? $"namespace {@namespace}\n{{\n{content}}}\n"
: content;
}
public static string RemoveSuffix(this string str, string suffix)
{
return str.EndsWith(suffix, StringComparison.Ordinal)
? str.Substring(0, str.Length - suffix.Length)
: str;
}
public static string ContextPrefix(string context)
{
return context.RemoveSuffix("Context");
}
public static string ContextAware(string contextPrefix)
{
return contextPrefix.Replace(".", string.Empty);
}
public static string ComponentMethodParams(ComponentDeclaration component) =>
string.Join(", ", component.Members.Select(static member => $"{member.Type} {member.ValidLowerFirstName}"));
public static string ComponentMethodArgs(ComponentDeclaration component) =>
string.Join(", ", component.Members.Select(static member => $"{member.ValidLowerFirstName}"));
public static string ComponentValueMethodArgs(ComponentDeclaration component) =>
string.Join(", ", component.Members.Select(static member => $"component.{member.Name}"));
public static string ComponentValueAssignments(ComponentDeclaration component) =>
string.Join("\n", component.Members.Select(static member => $" component.{member.Name} = {member.ValidLowerFirstName};"));
}
}
================================================
FILE: samples/Unity/.editorconfig
================================================
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
tab_width = 4
trim_trailing_whitespace = true
[*.sln]
indent_style = tab
[*.csproj]
indent_size = 2
ij_xml_space_inside_empty_tag = true
[*.DotSettings]
indent_style = tab
ij_xml_attribute_wrap = off
# [*.cs]
# entitas_generator.component.cleanup_systems = false
# entitas_generator.component.component_index = false
# entitas_generator.component.context_extension = false
# entitas_generator.component.context_initialization_method = false
# entitas_generator.component.entity_extension = false
# entitas_generator.component.entity_index_extension = false
# entitas_generator.component.events = false
# entitas_generator.component.event_systems_extension = false
# entitas_generator.component.matcher = false
#
# entitas_generator.context.component_index = false
# entitas_generator.context.context = false
# entitas_generator.context.entity = false
# entitas_generator.context.matcher = false
================================================
FILE: samples/Unity/Assets/Plugins.meta
================================================
fileFormatVersion: 2
guid: 2ce47528879ae462f9e00aef0ce4c26b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Editor/CustomObjectDrawer.cs
================================================
using System;
using Entitas.Unity.Editor;
using UnityEditor;
public class CustomObjectDrawer : ITypeDrawer, IDefaultInstanceCreator
{
public bool HandlesType(Type type) => type == typeof(MyCustomObject);
public object CreateDefault(Type type) => new MyCustomObject("Default");
public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target)
{
var myObject = (MyCustomObject)value;
myObject.Name = EditorGUILayout.TextField(memberName, myObject.Name);
return myObject;
}
}
================================================
FILE: samples/Unity/Assets/Sample/Editor/CustomObjectDrawer.cs.meta
================================================
fileFormatVersion: 2
guid: f139ea7f89bfd430ca7ae4bdf876b48d
timeCreated: 1487547487
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Editor/PersonComponentDrawer.cs
================================================
using System;
using Entitas;
using Entitas.Unity.Editor;
using UnityEditor;
public class PersonComponentDrawer : IComponentDrawer
{
public bool HandlesType(Type type) => type == typeof(MyPersonComponent);
public IComponent DrawComponent(IComponent component)
{
var person = (MyPersonComponent)component;
person.Name = EditorGUILayout.TextField("Name", person.Name);
person.Gender ??= PersonGender.Male.ToString();
var gender = (PersonGender)Enum.Parse(typeof(PersonGender), person.Gender);
gender = (PersonGender)EditorGUILayout.EnumPopup("Gender", gender);
person.Gender = gender.ToString();
return person;
}
enum PersonGender
{
Male,
Female
}
}
================================================
FILE: samples/Unity/Assets/Sample/Editor/PersonComponentDrawer.cs.meta
================================================
fileFormatVersion: 2
guid: be7914664e5264280ac6c734caa48785
timeCreated: 1460665985
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Editor.meta
================================================
fileFormatVersion: 2
guid: d0d330747609f469d9222aaca8596864
folderAsset: yes
timeCreated: 1455739666
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyArray2DComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyArray2DComponent : IComponent
{
public string[,] Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyArray2DComponent.cs.meta
================================================
fileFormatVersion: 2
guid: f31e6e9c6ad04f4b92f11a0a2e0ca9b6
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyArray3DComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyArray3DComponent : IComponent
{
public string[,,] Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyArray3DComponent.cs.meta
================================================
fileFormatVersion: 2
guid: d616f6566f1f471cbbc373c057650786
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyArrayComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyArrayComponent : IComponent
{
public string[] Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyArrayComponent.cs.meta
================================================
fileFormatVersion: 2
guid: a4fc4922dfd4d490db56d6180cd6436b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyCharComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyCharComponent : IComponent
{
public char Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyCharComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 3b77b0155ae246a4b0a585ff0ef3a153
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyCustomObjectComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyCustomObjectComponent : IComponent
{
public MyCustomObject Value;
}
public class MyCustomObject
{
public string Name;
public MyCustomObject(string name)
{
Name = name;
}
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyCustomObjectComponent.cs.meta
================================================
fileFormatVersion: 2
guid: eecc2a73ca63436485acaf861665bf71
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyDateTimeComponent.cs
================================================
using System;
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyDateTimeComponent : IComponent
{
public DateTime Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyDateTimeComponent.cs.meta
================================================
fileFormatVersion: 2
guid: d00ba15066ed4ae89571832b1702c7fb
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyDictArrayComponent.cs
================================================
using System.Collections.Generic;
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyDictArrayComponent : IComponent
{
public Dictionary Dict;
public Dictionary[] DictArray;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyDictArrayComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 244ce0249a4241ef98ecb6a50e3403cd
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyDictionaryComponent.cs
================================================
using System.Collections.Generic;
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyDictionaryComponent : IComponent
{
public Dictionary Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyDictionaryComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 8d1bfafeb2824ce3ad3f77528ebf1e9b
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyDontDrawComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
using Entitas.Unity;
[Context(typeof(GameContext)), DontDrawComponent]
public sealed class MyDontDrawComponent : IComponent
{
public MySimpleObject Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyDontDrawComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 9de382a297974f668bf96f81d0322aec
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyFlagComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyFlagComponent : IComponent { }
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyFlagComponent.cs.meta
================================================
fileFormatVersion: 2
guid: ffc162171ca324d40985306053b0bc26
timeCreated: 1455739666
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyHashSetComponent.cs
================================================
using System.Collections.Generic;
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyHashSetComponent : IComponent
{
public HashSet Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyHashSetComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 86b49e56cb2c45b19c2e1e71e79e4969
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyJaggedArrayComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyJaggedArrayComponent : IComponent
{
public string[][] Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyJaggedArrayComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 441ea2d1ab54433f8f478b274b5895ff
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyListArrayComponent.cs
================================================
using System.Collections.Generic;
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyListArrayComponent : IComponent
{
public List[] Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyListArrayComponent.cs.meta
================================================
fileFormatVersion: 2
guid: b58f3f34a6f34172bc4c93fed2a79b18
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyListComponent.cs
================================================
using System.Collections.Generic;
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyListComponent : IComponent
{
public List Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyListComponent.cs.meta
================================================
fileFormatVersion: 2
guid: eaaacc8162f64d25b71d157ba61d15ce
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyMemberListComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyMemberListComponent : IComponent
{
public string Field1;
public string Field2;
public string Field3;
public string Field4;
public string Field5;
public string Field6;
public string Field7;
public string Field8;
public string Field9;
public string Field10;
public string Field11;
public string Field12;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyMemberListComponent.cs.meta
================================================
fileFormatVersion: 2
guid: e189a338eb33432d8209e890900c8271
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyMonoBehaviourSubClassComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
using UnityEngine;
[Context(typeof(GameContext))]
public sealed class MyMonoBehaviourSubClassComponent : IComponent
{
public MyMonoBehaviourSubClass Value;
}
public class MyMonoBehaviourSubClass : MonoBehaviour { }
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyMonoBehaviourSubClassComponent.cs.meta
================================================
fileFormatVersion: 2
guid: e95c61aa3b494c1f8f289c1be247369a
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyPersonComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyPersonComponent : IComponent
{
public string Name;
public string Gender;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyPersonComponent.cs.meta
================================================
fileFormatVersion: 2
guid: a7251cf074c2417d9ab628ebc39842cc
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyPropertyComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyPropertyComponent : IComponent
{
public string Value { get; set; }
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyPropertyComponent.cs.meta
================================================
fileFormatVersion: 2
guid: cc2f53ac7164424ab6219efff219eef2
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MySimpleObjectComponent.cs
================================================
using System.Collections.Generic;
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MySimpleObjectComponent : IComponent
{
public MySimpleObject Value;
}
public class MySimpleObject
{
public string Name;
public int Age;
public Dictionary Data;
public MyCustomObject MyCustomObject;
public MySimpleObject Next;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MySimpleObjectComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 55948d11b3424ecd81ec848e2b893a33
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MySystemObjectComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MySystemObjectComponent : IComponent
{
public System.Object Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MySystemObjectComponent.cs.meta
================================================
fileFormatVersion: 2
guid: c7d9ee97b0ad4688a2ce1b1b88d1e047
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyUniqueComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext)), Unique]
public sealed class MyUniqueComponent : IComponent
{
public string Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyUniqueComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 33368b26a3264a8e8db86b4299e8d7e1
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyUnsupportedObjectComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyUnsupportedObjectComponent : IComponent
{
public UnsupportedObject Value;
}
public class UnsupportedObject
{
public string Value;
public UnsupportedObject(string value)
{
Value = value;
}
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/MyUnsupportedObjectComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 97beb1b2da064350968b5eb8d89e386d
timeCreated: 1667936395
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyAnimationCurveComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
using UnityEngine;
[Context(typeof(GameContext))]
public sealed class MyAnimationCurveComponent : IComponent
{
public AnimationCurve Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyAnimationCurveComponent.cs.meta
================================================
fileFormatVersion: 2
guid: cd6ffe73cc91487da0205160330a0203
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyBoolComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyBoolComponent : IComponent
{
public bool Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyBoolComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 6114f99c89284d02bba2818f93d4b488
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyBoundsComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
using UnityEngine;
[Context(typeof(GameContext))]
public sealed class MyBoundsComponent : IComponent
{
public Bounds Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyBoundsComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 607c2d9959a6e4db58ece12f4d320a0f
timeCreated: 1455739666
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyColorComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
using UnityEngine;
[Context(typeof(GameContext))]
public sealed class MyColorComponent : IComponent
{
public Color Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyColorComponent.cs.meta
================================================
fileFormatVersion: 2
guid: de957506614f4d9fb03ea4b5267ca0bc
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyDoubleComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyDoubleComponent : IComponent
{
public double Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyDoubleComponent.cs.meta
================================================
fileFormatVersion: 2
guid: ae6e38e9a97b44d5b79250a7a84d4c83
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyEnumComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyEnumComponent : IComponent
{
public MyEnum Value;
}
public enum MyEnum
{
Item1,
Item2,
Item3
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyEnumComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 13ec734e954d45daa3feb3293b4d4e02
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyFlagsComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyFlagsComponent : IComponent
{
public MyFlags Value;
}
[System.Flags]
public enum MyFlags
{
Item1 = 1,
Item2 = 2,
Item3 = 4,
Item4 = 8
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyFlagsComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 7eca5917c1e943029dca756272db5679
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyFloatComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyFloatComponent : IComponent
{
public float Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyFloatComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 614252080b7d4a03b49a0ed5d2e1682d
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyGameObjectComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
using UnityEngine;
[Context(typeof(GameContext))]
public sealed class MyGameObjectComponent : IComponent
{
public GameObject Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyGameObjectComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 67a47ddd017646da9db95a6c52a7bbd5
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyIntComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext))]
public sealed class MyIntComponent : IComponent
{
public int Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyIntComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 38b3229004104b9aa19c34de5ee2812a
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyRectComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
using UnityEngine;
[Context(typeof(GameContext))]
public sealed class MyRectComponent : IComponent
{
public Rect Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyRectComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 314993c54360444ebd3ac933a667f11a
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyStringComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext)), Context(typeof(InputContext))]
public sealed class MyStringComponent : IComponent
{
public string Value;
public override string ToString() => $"MyString({Value})";
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyStringComponent.cs.meta
================================================
fileFormatVersion: 2
guid: b4c6e703065242cc95c2c2917ecb9c42
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyTexture2DComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
using UnityEngine;
[Context(typeof(GameContext))]
public sealed class MyTexture2DComponent : IComponent
{
public Texture2D Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyTexture2DComponent.cs.meta
================================================
fileFormatVersion: 2
guid: ee9f3e8394d44a99867d24b55aa3e4f4
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyTextureComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
using UnityEngine;
[Context(typeof(GameContext))]
public sealed class MyTextureComponent : IComponent
{
public Texture Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyTextureComponent.cs.meta
================================================
fileFormatVersion: 2
guid: c4cdcbb081214b9d9b2b086ecd49f209
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyUnityObjectComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
using UnityEngine;
[Context(typeof(GameContext))]
public sealed class MyUnityObjectComponent : IComponent
{
public Object Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyUnityObjectComponent.cs.meta
================================================
fileFormatVersion: 2
guid: d0cfe10a31f443a580841ff640c31a00
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyVector2Component.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
using UnityEngine;
[Context(typeof(GameContext))]
public sealed class MyVector2Component : IComponent
{
public Vector2 Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyVector2Component.cs.meta
================================================
fileFormatVersion: 2
guid: 4f7d2cc8dac94298abcf672906c17cf7
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyVector3Component.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
using UnityEngine;
[Context(typeof(GameContext))]
public sealed class MyVector3Component : IComponent
{
public Vector3 Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyVector3Component.cs.meta
================================================
fileFormatVersion: 2
guid: 5df4c97495d94a75ab8ab1a5f1ccef46
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyVector4Component.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
using UnityEngine;
[Context(typeof(GameContext))]
public sealed class MyVector4Component : IComponent
{
public Vector4 Value;
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyVector4Component.cs.meta
================================================
fileFormatVersion: 2
guid: 3ef196888c544a12b34f68e104a3af96
timeCreated: 1667936720
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes.meta
================================================
fileFormatVersion: 2
guid: fc42c211fea84a67a0ed15d5d9a3cb8b
timeCreated: 1667936693
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components Scene.unity
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 3
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &4
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 1
m_BakeResolution: 50
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 0
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 0
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 1024
m_ReflectionCompression: 2
m_MixedBakeMode: 1
m_BakeBackend: 0
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 500
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 0
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 4890085278179872738, guid: 9af8a2892cbe14f82a27a743174607e3, type: 2}
--- !u!196 &5
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666666
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &1782340940
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1782340942}
- component: {fileID: 1782340941}
m_Layer: 0
m_Name: Controller
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1782340941
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1782340940}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b7a971593563c452781677abaf62f41b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1782340942
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1782340940}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components Scene.unity.meta
================================================
fileFormatVersion: 2
guid: 8646dd6b1da3a4568b60fe085252f2bf
timeCreated: 1455739666
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Components.meta
================================================
fileFormatVersion: 2
guid: 713b02e4749e4da889797530373f60e3
timeCreated: 1667936307
================================================
FILE: samples/Unity/Assets/Sample/Runtime/ComponentsController.cs
================================================
using System;
using System.Collections.Generic;
using Entitas.Unity;
using UnityEngine;
using static GameMyGameObjectMatcher;
using static GameMyVector3Matcher;
public class ComponentsController : MonoBehaviour
{
void Start()
{
ContextInitialization.InitializeAllContexts();
var gameContext = new GameContext();
gameContext.CreateContextObserver();
CreateTestGroups(gameContext);
CreateTestEntities(gameContext);
CreateTestEntityWithNullValues(gameContext);
CreateTestEntityError(gameContext);
}
void CreateTestGroups(GameContext context)
{
context.GetGroup(MyVector3);
context.GetGroup(MyGameObject);
context.GetGroup(Game.Matcher.AllOf(MyGameObject, MyVector3));
context.GetGroup(Game.Matcher.AllOf(MyGameObject, MyVector3));
}
void CreateTestEntities(GameContext context)
{
for (var i = 0; i < 2; i++)
{
var entity = context.CreateEntity();
// Unity's builtIn
entity.AddMyAnimationCurve(AnimationCurve.EaseInOut(0f, 0f, 1f, 1f));
entity.AddMyBool(true);
entity.AddMyBounds(new Bounds());
entity.AddMyColor(Color.red);
entity.AddMyDouble(4.2f);
entity.AddMyEnum(MyEnum.Item2);
entity.AddMyFlags(MyFlags.Item2);
entity.AddMyFloat(4.2f);
entity.AddMyGameObject(new GameObject("Player").Link(entity).gameObject);
entity.AddMyInt(42);
entity.AddMyRect(new Rect(1f, 2f, 3f, 4f));
entity.AddMyString("Hello, world!");
entity.AddMyTexture2D(new Texture2D(2, 2));
entity.AddMyTexture(new CustomRenderTexture(32, 32));
entity.AddMyUnityObject(new UnityEngine.Object());
entity.AddMyVector2(new Vector2(1f, 2f));
entity.AddMyVector3(new Vector3(1f, 2f, 3f));
entity.AddMyVector4(new Vector4(1f, 2f, 3f, 4f));
// Custom
entity.AddMyArray2D(new string[2, 3]);
entity.AddMyArray3D(new string[2, 3, 4]);
entity.AddMyArray(new[] { "1", "2", "3" });
entity.AddMyChar('x');
entity.AddMyCustomObject(new MyCustomObject("My Custom Object!"));
entity.AddMyDateTime(DateTime.Now);
entity.AddMyDictArray(
new Dictionary
{
{ 1, new[] { "One", "Two", "Three" } },
{ 2, new[] { "Four", "Five", "Six" } }
},
new[]
{
new Dictionary
{
{ 1, new[] { "One", "Two", "Three" } },
{ 2, new[] { "Four", "Five", "Six" } }
},
new Dictionary
{
{ 3, new[] { "One", "Two", "Three" } },
{ 4, new[] { "Four", "Five", "Six" } }
}
}
);
entity.AddMyDictionary(new Dictionary
{
{ "1", "One" },
{ "2", "Two" },
{ "3", "Three" }
});
entity.AddMyDontDraw(new MySimpleObject());
entity.AddMyFlag();
entity.AddMyHashSet(new HashSet { "1", "2", "3" });
var jaggedArray = new string[2][];
jaggedArray[0] = new[] { "Entity", "Component", "System" };
jaggedArray[1] = new[] { "For", "C#" };
entity.AddMyJaggedArray(jaggedArray);
entity.AddMyListArray(new[]
{
new List { "1", "2", "3" },
new List { "One", "Two", "Three" }
});
entity.AddMyList(new List { "One", "Two", "Three" });
entity.AddMyMemberList("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12");
entity.AddMyMonoBehaviourSubClass(new GameObject().AddComponent());
entity.AddMyPerson("Max", "Male");
entity.AddMyProperty("My Property!");
entity.AddMySimpleObject(new MySimpleObject());
entity.AddMySystemObject(new object());
entity.AddMyUnique("My Unique!");
entity.AddMyUnsupportedObject(new UnsupportedObject("Unsupported Object"));
}
}
void CreateTestEntityWithNullValues(GameContext context)
{
var entity = context.CreateEntity();
entity.AddMyAnimationCurve(null);
entity.AddMyGameObject(null);
entity.AddMyString(null);
entity.AddMyTexture2D(null);
entity.AddMyTexture(null);
entity.AddMyUnityObject(null);
// Custom
entity.AddMyArray2D(null);
entity.AddMyArray3D(null);
entity.AddMyArray(null);
entity.AddMyCustomObject(null);
entity.AddMyDictArray(null, null);
entity.AddMyDictionary(null);
entity.AddMyDontDraw(null);
entity.AddMyHashSet(null);
entity.AddMyJaggedArray(null);
entity.AddMyListArray(null);
entity.AddMyList(null);
entity.AddMyMemberList(null, null, null, null, null, null, null, null, null, null, null, null);
entity.AddMyMonoBehaviourSubClass(null);
entity.AddMyPerson(null, null);
entity.AddMyProperty(null);
entity.AddMySimpleObject(null);
entity.AddMySystemObject(null);
entity.AddMyUnique(null);
entity.AddMyUnsupportedObject(null);
}
void CreateTestEntityError(GameContext context)
{
var entity = context.CreateEntity();
entity.Retain(this);
entity.Destroy();
}
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/ComponentsController.cs.meta
================================================
fileFormatVersion: 2
guid: b7a971593563c452781677abaf62f41b
timeCreated: 1455739666
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Contexts/ContextInitialization.cs
================================================
using Entitas.Generators.Attributes;
public static partial class ContextInitialization
{
public static void InitializeAllContexts()
{
InitializeGameContext();
InitializeInputContext();
}
[ContextInitialization(typeof(GameContext))]
public static partial void InitializeGameContext();
[ContextInitialization(typeof(InputContext))]
public static partial void InitializeInputContext();
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Contexts/ContextInitialization.cs.meta
================================================
fileFormatVersion: 2
guid: 3de139e489844b6fb5d326d5cfe52aff
timeCreated: 1690465874
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Contexts/GameContext.cs
================================================
using Entitas;
partial class GameContext : IContext { }
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Contexts/GameContext.cs.meta
================================================
fileFormatVersion: 2
guid: a13516d2b8cd420c8a7613f2f3bc4480
timeCreated: 1690465381
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Contexts/InputContext.cs
================================================
using Entitas;
partial class InputContext : IContext { }
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Contexts/InputContext.cs.meta
================================================
fileFormatVersion: 2
guid: 87b3133efe3d436eb8e6f77b85622d45
timeCreated: 1690465697
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Contexts.meta
================================================
fileFormatVersion: 2
guid: 68d5ad989369407ca8a797a7f2921ff1
timeCreated: 1690465858
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/AReactiveSystem.cs
================================================
using System.Collections.Generic;
using System.Threading;
using Entitas;
public class AReactiveSystem : ReactiveSystem
{
public AReactiveSystem(GameContext context) : base(context) { }
protected override ICollector GetTrigger(IContext context) =>
context.CreateCollector(GameMyStringMatcher.MyString);
protected override bool Filter(Game.Entity entity) => true;
protected override void Execute(List entities)
{
Thread.Sleep(2);
}
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/AReactiveSystem.cs.meta
================================================
fileFormatVersion: 2
guid: 8133bd2e30cfc4cd9a1ab205c8b3a288
timeCreated: 1432070018
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/CleanupSystem.cs
================================================
using Entitas;
public class CleanupSystem : ICleanupSystem
{
public void Cleanup() { }
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/CleanupSystem.cs.meta
================================================
fileFormatVersion: 2
guid: 26667bf2484024d36b5cca1aaf56f8de
timeCreated: 1475865147
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/FastSystem.cs
================================================
using System.Threading;
using Entitas;
public class FastSystem : IExecuteSystem
{
public void Execute()
{
Thread.Sleep(1);
}
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/FastSystem.cs.meta
================================================
fileFormatVersion: 2
guid: 4dbba0f12e8184b3a8ab30d670ca9692
timeCreated: 1432070018
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/MixedSystem.cs
================================================
using Entitas;
public class MixedSystem : IInitializeSystem, IExecuteSystem, ICleanupSystem, ITearDownSystem
{
public void Initialize()
{
//UnityEngine.Debug.Log("Initialize");
}
public void Execute()
{
//UnityEngine.Debug.Log("Execute");
}
public void Cleanup()
{
//UnityEngine.Debug.Log("Cleanup");
}
public void TearDown()
{
//UnityEngine.Debug.Log("TearDown");
}
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/MixedSystem.cs.meta
================================================
fileFormatVersion: 2
guid: 4ec7357cbe250481ebe3f79876871c99
timeCreated: 1475869353
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/ProcessRandomValueSystem.cs
================================================
using System.Collections.Generic;
using Entitas;
public class ProcessRandomValueSystem : ReactiveSystem
{
public ProcessRandomValueSystem(GameContext context) : base(context) { }
protected override ICollector GetTrigger(IContext context) =>
context.CreateCollector(GameMyFloatMatcher.MyFloat);
protected override bool Filter(Game.Entity entity) => true;
protected override void Execute(List entities)
{
foreach (var entity in entities)
entity.Destroy();
}
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/ProcessRandomValueSystem.cs.meta
================================================
fileFormatVersion: 2
guid: e29e8e4de9c25452882614e48c0287a3
timeCreated: 1437218791
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/RandomDurationSystem.cs
================================================
using System.Threading;
using UnityEngine;
using Entitas;
public class RandomDurationSystem : IExecuteSystem
{
public void Execute()
{
Thread.Sleep(Random.Range(0, 9));
}
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/RandomDurationSystem.cs.meta
================================================
fileFormatVersion: 2
guid: 3d923a0b40aec4c62a883bcf5d32266e
timeCreated: 1432152477
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/RandomValueSystem.cs
================================================
using Entitas;
using UnityEngine;
public class RandomValueSystem : IExecuteSystem
{
readonly GameContext _context;
public RandomValueSystem(GameContext context)
{
_context = context;
}
public void Execute()
{
_context.CreateEntity().AddMyFloat(Random.value);
}
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/RandomValueSystem.cs.meta
================================================
fileFormatVersion: 2
guid: 5470c556108894357a24a68dd92da480
timeCreated: 1437218791
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SlowInitializeExecuteSystem.cs
================================================
using System.Threading;
using Entitas;
public class SlowInitializeExecuteSystem : IInitializeSystem, IExecuteSystem
{
public void Initialize()
{
Thread.Sleep(10);
}
public void Execute()
{
Thread.Sleep(5);
}
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SlowInitializeExecuteSystem.cs.meta
================================================
fileFormatVersion: 2
guid: 651ddcb189b494f1fb48addac219efb9
timeCreated: 1439754586
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SlowInitializeSystem.cs
================================================
using System.Threading;
using Entitas;
public class SlowInitializeSystem : IInitializeSystem
{
public void Initialize()
{
Thread.Sleep(30);
}
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SlowInitializeSystem.cs.meta
================================================
fileFormatVersion: 2
guid: 57c7a0da41d924d80a58d9e78528fbbe
timeCreated: 1439754586
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SlowSystem.cs
================================================
using System.Threading;
using Entitas;
public class SlowSystem : IExecuteSystem
{
public void Execute()
{
Thread.Sleep(4);
}
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SlowSystem.cs.meta
================================================
fileFormatVersion: 2
guid: ae066f52c9bcc4079a6c20142b5150fa
timeCreated: 1432070018
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SomeExecuteSystem.cs
================================================
using Entitas;
public class SomeExecuteSystem : IExecuteSystem
{
public void Execute() { }
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SomeExecuteSystem.cs.meta
================================================
fileFormatVersion: 2
guid: 351bfdecb9eef45019db0b774e0b0652
timeCreated: 1433409297
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SomeInitializeExecuteSystem.cs
================================================
using Entitas;
public class SomeInitializeExecuteSystem : IInitializeSystem, IExecuteSystem
{
public void Initialize() { }
public void Execute() { }
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SomeInitializeExecuteSystem.cs.meta
================================================
fileFormatVersion: 2
guid: ebb325d92872b412b8b4da1e47651ca7
timeCreated: 1439754586
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SomeInitializeReactiveSystem.cs
================================================
using System.Collections.Generic;
using Entitas;
public class SomeInitializeReactiveSystem : ReactiveSystem, IInitializeSystem
{
public SomeInitializeReactiveSystem(GameContext context) : base(context) { }
protected override ICollector GetTrigger(IContext context) =>
context.CreateCollector(Game.Matcher.AllOf(0));
protected override bool Filter(Game.Entity entity) => true;
public void Initialize() { }
protected override void Execute(List entities) { }
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SomeInitializeReactiveSystem.cs.meta
================================================
fileFormatVersion: 2
guid: 13904dc9959364090bef258311f3183a
timeCreated: 1439754586
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SomeInitializeSystem.cs
================================================
using Entitas;
public class SomeInitializeSystem : IInitializeSystem
{
public void Initialize() { }
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SomeInitializeSystem.cs.meta
================================================
fileFormatVersion: 2
guid: 27103eba44f8a4d8b927a9bcdaf488a5
timeCreated: 1439754586
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SomeReactiveSystem.cs
================================================
using System.Collections.Generic;
using Entitas;
public class SomeReactiveSystem : ReactiveSystem
{
public SomeReactiveSystem(GameContext context) : base(context) { }
protected override ICollector GetTrigger(IContext context) =>
context.CreateCollector(Matcher.AllOf(0));
protected override bool Filter(Game.Entity entity) => true;
protected override void Execute(List entities) { }
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/SomeReactiveSystem.cs.meta
================================================
fileFormatVersion: 2
guid: 5c67dabd77edc40f1b8a6d30e6b54799
timeCreated: 1433409297
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/TearDownSystem.cs
================================================
using Entitas;
public class TearDownSystem : ITearDownSystem
{
public void TearDown()
{
UnityEngine.Debug.Log("TearDown");
}
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems/TearDownSystem.cs.meta
================================================
fileFormatVersion: 2
guid: e9f7d828623b24718b8d95c4ec445697
timeCreated: 1475865479
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems Scene.unity
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 3
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &4
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 1
m_BakeResolution: 50
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 0
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 0
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 1024
m_ReflectionCompression: 2
m_MixedBakeMode: 1
m_BakeBackend: 0
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 500
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 0
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 4890085278179872738, guid: a6827277473d94d43b00d874f23fc554, type: 2}
--- !u!196 &5
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666666
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &1782340940
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1782340942}
- component: {fileID: 1782340943}
m_Layer: 0
m_Name: Controller
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1782340942
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1782340940}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1782340943
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1782340940}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 673279bc6aa4344039fa3f2674348d6f, type: 3}
m_Name:
m_EditorClassIdentifier:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems Scene.unity.meta
================================================
fileFormatVersion: 2
guid: e2a9126de78c74296a0da24cc0363b9a
timeCreated: 1455739666
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/Systems.meta
================================================
fileFormatVersion: 2
guid: 6b323d75517db4e3ba60b474a4c6c595
folderAsset: yes
timeCreated: 1455739666
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime/SystemsController.cs
================================================
using Entitas;
using Entitas.Unity;
using UnityEngine;
public class SystemsController : MonoBehaviour
{
GameContext _gameContext;
Systems _systems;
void Start()
{
ContextInitialization.InitializeAllContexts();
_gameContext = new GameContext();
_gameContext.CreateContextObserver();
_systems = CreateNestedSystems();
//// Test calls
_systems.Initialize();
_systems.Execute();
_systems.Cleanup();
_systems.TearDown();
_gameContext.CreateEntity().AddMyString("");
}
Systems CreateNestedSystems()
{
var systems1 = new Feature("Nested 1");
var systems2 = new Feature("Nested 2");
var systems3 = new Feature("Nested 3");
systems1.Add(systems2);
systems2.Add(systems3);
systems1.Add(CreateSomeSystems());
return new Feature("Nested Systems")
.Add(systems1);
}
Systems CreateSomeSystems()
{
return new SomeSystems(_gameContext);
}
void Update()
{
_gameContext.GetGroup(GameMyStringMatcher.MyString).GetSingleEntity()
.ReplaceMyString(Random.value.ToString());
_systems.Execute();
_systems.Cleanup();
}
Systems CreateAllSystemCombinations()
{
return new Feature("All System Combinations")
.Add(new SomeInitializeSystem())
.Add(new SomeExecuteSystem())
.Add(new SomeReactiveSystem(_gameContext))
.Add(new SomeInitializeExecuteSystem())
.Add(new SomeInitializeReactiveSystem(_gameContext));
}
Systems CreateSubSystems()
{
var allSystems = CreateAllSystemCombinations();
var subSystems = new Feature("Sub Systems").Add(allSystems);
return new Feature("Systems with SubSystems")
.Add(allSystems)
.Add(allSystems)
.Add(subSystems)
.Add(subSystems);
}
Systems CreateSameInstance()
{
var system = new RandomDurationSystem();
return new Feature("Same System Instances")
.Add(system)
.Add(system)
.Add(system);
}
Systems CreateEmptySystems()
{
var systems1 = new Feature("Empty 1");
var systems2 = new Feature("Empty 2");
var systems3 = new Feature("Empty 3");
systems1.Add(systems2);
systems2.Add(systems3);
return new Feature("Empty Systems")
.Add(systems1);
}
sealed class SomeSystems : Feature
{
public SomeSystems(GameContext gameContext)
{
Add(new SlowInitializeSystem());
Add(new SlowInitializeExecuteSystem());
Add(new FastSystem());
Add(new SlowSystem());
Add(new RandomDurationSystem());
Add(new AReactiveSystem(gameContext));
Add(new RandomValueSystem(gameContext));
Add(new ProcessRandomValueSystem(gameContext));
Add(new CleanupSystem());
Add(new TearDownSystem());
Add(new MixedSystem());
}
}
}
================================================
FILE: samples/Unity/Assets/Sample/Runtime/SystemsController.cs.meta
================================================
fileFormatVersion: 2
guid: 673279bc6aa4344039fa3f2674348d6f
timeCreated: 1455739666
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Runtime.meta
================================================
fileFormatVersion: 2
guid: 48b3b593753ab4ac48e8623ed018ed73
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Editor/Tests/ContextTests.cs
================================================
using System.Linq;
using NUnit.Framework;
using Entitas;
[TestFixture]
class ContextTests
{
[Test]
public void EnsuresSameDeterministicOrderWhenGettingEntitiesAfterDestroyAllEntities()
{
ContextInitialization.InitializeAllContexts();
var gameContext = new Context(1, () => new Game.Entity());
const int numEntities = 10;
for (var i = 0; i < numEntities; i++)
gameContext.CreateEntity();
var order1 = gameContext.GetEntities().Select(entity => entity.Id).ToArray();
gameContext.Reset();
for (var i = 0; i < numEntities; i++)
gameContext.CreateEntity();
var order2 = gameContext.GetEntities().Select(entity => entity.Id).ToArray();
for (var i = 0; i < numEntities; i++)
{
var index1 = order1[i];
var index2 = order2[i];
Assert.AreEqual(index1, index2);
}
}
}
================================================
FILE: samples/Unity/Assets/Sample/Tests/Editor/Tests/ContextTests.cs.meta
================================================
fileFormatVersion: 2
guid: 640477ba833484d4b9ca68074efa0c9a
timeCreated: 1483966795
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Editor/Tests/EntityLinkTests.cs
================================================
using System;
using Entitas;
using Entitas.Unity;
using NUnit.Framework;
using UnityEngine;
public class EntityLinkTests
{
GameContext _context;
Entity _entity;
GameObject _gameObject;
EntityLink _link;
[SetUp]
public void BeforeEach()
{
ContextInitialization.InitializeAllContexts();
_context = new GameContext();
_context.CreateContextObserver();
_entity = _context.CreateEntity();
_gameObject = new GameObject("TestGameObject");
_link = _gameObject.AddComponent();
}
[Test]
public void LinksEntityAndContextAndRetainsEntity()
{
var retainCount = _entity.RetainCount;
_link.Link(_entity);
Assert.AreSame(_entity, _link.Entity);
Assert.AreEqual(retainCount + 1, _entity.RetainCount);
#if !ENTITAS_FAST_AND_UNSAFE
Assert.IsTrue(((SafeAERC)_entity.Aerc).Owners.Contains(_link));
#endif
}
[Test]
public void ThrowsWhenAlreadyLinked()
{
Assert.Throws(typeof(Exception), () =>
{
_link.Link(_entity);
_link.Link(_entity);
});
}
[Test]
public void UnlinksEntityReleasesEntity()
{
_link.Link(_entity);
var retainCount = _entity.RetainCount;
_link.Unlink();
Assert.AreEqual(retainCount - 1, _entity.RetainCount);
Assert.IsNull(_link.Entity);
#if !ENTITAS_FAST_AND_UNSAFE
Assert.IsFalse(((SafeAERC)_entity.Aerc).Owners.Contains(_link));
#endif
}
[Test]
public void ThrowsWhenAlreadyUnlinked()
{
Assert.Throws(typeof(Exception), () => _link.Unlink());
}
[Test]
public void GetSameEntityLink()
{
Assert.AreSame(_link, _gameObject.GetEntityLink());
}
[Test]
public void AddsEntityLinkAndLinks()
{
var gameObject = new GameObject();
var retainCount = _entity.RetainCount;
var link = gameObject.Link(_entity);
Assert.AreSame(link, gameObject.GetEntityLink());
Assert.AreSame(_entity, link.Entity);
Assert.AreEqual(retainCount + 1, _entity.RetainCount);
}
[Test]
public void Unlinks()
{
var gameObject = new GameObject();
var link = gameObject.Link(_entity);
var retainCount = _entity.RetainCount;
gameObject.Unlink();
Assert.AreSame(link, gameObject.GetEntityLink());
Assert.AreEqual(retainCount - 1, _entity.RetainCount);
Assert.IsNull(link.Entity);
}
[Test]
public void ReusesLink()
{
var gameObject = new GameObject();
var link1 = gameObject.Link(_context.CreateEntity());
gameObject.Unlink();
var link2 = gameObject.Link(_entity);
Assert.AreEqual(1, gameObject.GetComponents().Length);
Assert.AreSame(link1, link2);
Assert.AreSame(_entity, link2.Entity);
}
[Test]
public void CanToString()
{
Assert.AreEqual("EntityLink(TestGameObject)", _link.ToString());
}
}
================================================
FILE: samples/Unity/Assets/Sample/Tests/Editor/Tests/EntityLinkTests.cs.meta
================================================
fileFormatVersion: 2
guid: 56872c04364084e3c9fdd237e9f388c4
timeCreated: 1486169352
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Editor/Tests.meta
================================================
fileFormatVersion: 2
guid: 99230376fec554ead9805e15092fc6a8
folderAsset: yes
timeCreated: 1450119188
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Editor.meta
================================================
fileFormatVersion: 2
guid: 24957586ae4bc4cc383f088a35ff09de
folderAsset: yes
timeCreated: 1455740206
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Collector Destructor/Collector Destructor.unity
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
SceneSettings:
m_ObjectHideFlags: 0
m_PVSData:
m_PVSObjectsArray: []
m_PVSPortalsArray: []
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 6
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 6
m_GIWorkflowMode: 0
m_LightmapsMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 3
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AOMaxDistance: 1
m_Padding: 2
m_CompAOExponent: 0
m_LightmapParameters: {fileID: 0}
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherRayCount: 1024
m_ReflectionCompression: 2
m_LightingDataAsset: {fileID: 0}
m_RuntimeCPUUsage: 25
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
accuratePlacement: 0
minRegionArea: 2
cellSize: 0.16666667
manualCellSize: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &1576095025
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1576095027}
- 114: {fileID: 1576095026}
m_Layer: 0
m_Name: Controller
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1576095026
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1576095025}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 10fd605a7d77b4db381962061246c923, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1576095027
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1576095025}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Collector Destructor/Collector Destructor.unity.meta
================================================
fileFormatVersion: 2
guid: 2bcfbecd3f0a64750a3d8f54424d44fe
timeCreated: 1454970059
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Collector Destructor/CollectorDestructorController.cs
================================================
using UnityEngine;
using Entitas;
using Entitas.Unity;
using UnityEditor;
public class CollectorDestructorController : MonoBehaviour
{
GameContext _gameContext;
Game.Entity _initialEntity;
void Start()
{
ContextInitialization.InitializeAllContexts();
_gameContext = new GameContext();
_gameContext.CreateContextObserver();
_gameContext.GetGroup(GameTestMatcher.Test).CreateCollector();
_initialEntity = _gameContext.CreateEntity();
_initialEntity.AddTest();
_initialEntity.Destroy();
// TODO
// context.ClearGroups();
}
void Update()
{
for (var i = 0; i < 5000; i++)
{
var entity = _gameContext.CreateEntity();
if (entity == _initialEntity)
{
Debug.Log("Reusing entity!");
EditorApplication.isPlaying = false;
}
}
}
}
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Collector Destructor/CollectorDestructorController.cs.meta
================================================
fileFormatVersion: 2
guid: 10fd605a7d77b4db381962061246c923
timeCreated: 1454970059
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Collector Destructor.meta
================================================
fileFormatVersion: 2
guid: 5a4cd696ee62a4922a0f739f7afaa6fb
folderAsset: yes
timeCreated: 1454970059
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Entity Stress Test/Entity Stress Test Scene.unity
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.3731196, g: 0.38074002, b: 0.35872707, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 10
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &619302619
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 619302621}
- component: {fileID: 619302620}
m_Layer: 0
m_Name: Controller
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &619302620
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 619302619}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 285cc2b6c9e60419fb51e48c0011bb12, type: 3}
m_Name:
m_EditorClassIdentifier:
count: 1000
--- !u!4 &619302621
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 619302619}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Entity Stress Test/Entity Stress Test Scene.unity.meta
================================================
fileFormatVersion: 2
guid: 9693b73c9c95a4c2e951176a1fb5b355
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Entity Stress Test/EntityStressTestController.cs
================================================
using Entitas.Unity;
using UnityEngine;
public class EntityStressTestController : MonoBehaviour
{
public int count;
GameContext _gameContext;
bool _flag;
void Start()
{
ContextInitialization.InitializeAllContexts();
_gameContext = new GameContext();
_gameContext.CreateContextObserver();
// for (var i = 0; i < count; i++)
// {
// var e = _contexts.game.CreateEntity();
// e.AddMyInt(i);
// e.AddMyString(i.ToString());
// }
}
void Update()
{
// foreach (var e in _contexts.game.GetEntities())
// e.ReplaceMyInt(e.myInt.Value + 1);
if (Time.frameCount % 60 == 0)
{
_flag = !_flag;
if (_flag)
for (var i = 0; i < count; i++)
_gameContext.CreateEntity().AddMyInt(i);
else
foreach (var entity in _gameContext.GetEntities())
entity.Destroy();
}
}
}
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Entity Stress Test/EntityStressTestController.cs.meta
================================================
fileFormatVersion: 2
guid: 285cc2b6c9e60419fb51e48c0011bb12
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Entity Stress Test.meta
================================================
fileFormatVersion: 2
guid: 716397237436b4443bd27b1266b106cf
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/EntityLink/EntityLink Scene.unity
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.3708625, g: 0.37838694, b: 0.35726872, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 0
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 500
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 0
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 550312199}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!850595691 &550312199
LightingSettings:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Settings.lighting
serializedVersion: 4
m_GIWorkflowMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_RealtimeEnvironmentLighting: 1
m_BounceScale: 1
m_AlbedoBoost: 1
m_IndirectOutputScale: 1
m_UsingShadowmask: 1
m_BakeBackend: 0
m_LightmapMaxSize: 1024
m_BakeResolution: 40
m_Padding: 2
m_LightmapCompression: 3
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAO: 0
m_MixedBakeMode: 2
m_LightmapsBakeMode: 1
m_FilterMode: 1
m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_RealtimeResolution: 2
m_ForceWhiteAlbedo: 0
m_ForceUpdates: 0
m_FinalGather: 0
m_FinalGatherRayCount: 256
m_FinalGatherFiltering: 1
m_PVRCulling: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVREnvironmentSampleCount: 500
m_PVREnvironmentReferencePointCount: 2048
m_LightProbeSampleCountMultiplier: 4
m_PVRBounces: 2
m_PVRMinBounces: 2
m_PVREnvironmentMIS: 0
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_PVRTiledBaking: 0
--- !u!1 &994460076
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 994460078}
- component: {fileID: 994460077}
m_Layer: 0
m_Name: Controller
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &994460077
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 994460076}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6b7bce7896e0347d7bb51d6f8c8802e2, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &994460078
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 994460076}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/EntityLink/EntityLink Scene.unity.meta
================================================
fileFormatVersion: 2
guid: 4c3fef27b9afc47678153f816cb06e08
timeCreated: 1515794709
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/EntityLink/EntityLinkController.cs
================================================
using Entitas.Unity;
using UnityEngine;
public class EntityLinkController : MonoBehaviour
{
void Start()
{
ContextInitialization.InitializeAllContexts();
var gameContext = new GameContext();
gameContext.CreateContextObserver();
var entity = gameContext.CreateEntity();
var go = new GameObject();
go.Link(entity);
entity.AddMyGameObject(go);
// go.Unlink();
Destroy(go);
}
}
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/EntityLink/EntityLinkController.cs.meta
================================================
fileFormatVersion: 2
guid: 6b7bce7896e0347d7bb51d6f8c8802e2
timeCreated: 1515794616
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/EntityLink.meta
================================================
fileFormatVersion: 2
guid: 802031397194d49dc9b2b8a534477d68
folderAsset: yes
timeCreated: 1508969008
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Fixtures/TestComponent.cs
================================================
using Entitas;
using Entitas.Generators.Attributes;
[Context(typeof(GameContext)), Context(typeof(InputContext))]
public sealed class TestComponent : IComponent { }
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Fixtures/TestComponent.cs.meta
================================================
fileFormatVersion: 2
guid: 58dcfa315ac634f55b4f704b27a6d993
timeCreated: 1454969455
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Fixtures/TestReactiveSystem.cs
================================================
using System.Collections.Generic;
using Entitas;
public class TestReactiveSystem : ReactiveSystem
{
public TestReactiveSystem(GameContext context) : base(context) { }
protected override ICollector GetTrigger(IContext context) =>
context.CreateCollector(GameTestMatcher.Test);
protected override bool Filter(Game.Entity entity) => true;
protected override void Execute(List entities) { }
}
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Fixtures/TestReactiveSystem.cs.meta
================================================
fileFormatVersion: 2
guid: 224fbeb414af74d3ea0a3ab23bf8ff71
timeCreated: 1454969689
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Fixtures.meta
================================================
fileFormatVersion: 2
guid: a264ebe020ce546b183f93b3f1e5a48b
folderAsset: yes
timeCreated: 1457784847
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Group Alloc/Group Alloc Scene.unity
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.3708625, g: 0.37838694, b: 0.35726872, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 0
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 500
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 0
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 4890085278179872738, guid: bfafbdff0a29d4647bff350c279c1c36, type: 2}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &1169350011
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1169350013}
- component: {fileID: 1169350012}
m_Layer: 0
m_Name: Controller
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1169350012
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1169350011}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 78eba33893cf04b228baa507095ea482, type: 3}
m_Name:
m_EditorClassIdentifier:
Mode: 0
Count: 100
--- !u!4 &1169350013
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1169350011}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Group Alloc/Group Alloc Scene.unity.meta
================================================
fileFormatVersion: 2
guid: d9150b74acc734ada9a516a0fc679c99
timeCreated: 1519479689
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Group Alloc/GroupAllocController.cs
================================================
using System.Collections.Generic;
using Entitas;
using Entitas.Unity;
using UnityEngine;
public class GroupAllocController : MonoBehaviour
{
public GroupAlloc Mode;
public int Count;
readonly List _buffer = new List();
GameContext _gameContext;
IGroup _group;
void Start()
{
ContextInitialization.InitializeAllContexts();
_gameContext = new GameContext();
_gameContext.CreateContextObserver();
_group = _gameContext.GetGroup(GameMyIntMatcher.MyInt);
}
void Update()
{
_gameContext.DestroyAllEntities();
for (var i = 0; i < Count; i++)
_gameContext.CreateEntity().AddMyInt(i);
Iterate();
}
void Iterate()
{
switch (Mode)
{
case GroupAlloc.Group:
foreach (var entity in _group)
{
var unused = entity.GetMyInt().Value;
}
break;
case GroupAlloc.GetEntities:
foreach (var entity in _group.GetEntities())
{
var unused = entity.GetMyInt().Value;
}
break;
case GroupAlloc.GetEntitiesBuffer:
foreach (var entity in _group.GetEntities(_buffer))
{
var unused = entity.GetMyInt().Value;
}
break;
}
}
}
public enum GroupAlloc
{
Group,
GetEntities,
GetEntitiesBuffer
}
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Group Alloc/GroupAllocController.cs.meta
================================================
fileFormatVersion: 2
guid: 78eba33893cf04b228baa507095ea482
timeCreated: 1519479366
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Group Alloc.meta
================================================
fileFormatVersion: 2
guid: 8e86e453905c642329467e859a3b8f3b
folderAsset: yes
timeCreated: 1519479356
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Reactive System Exception/Reactive System Exception Scene.unity
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.3731196, g: 0.38074002, b: 0.35872707, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 10
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &335183607
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 335183609}
- component: {fileID: 335183608}
m_Layer: 0
m_Name: Controller
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &335183608
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 335183607}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: af88d9eb7bda418db410c5a1d92d419b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &335183609
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 335183607}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Reactive System Exception/Reactive System Exception Scene.unity.meta
================================================
fileFormatVersion: 2
guid: a15993e3c6d0c42ca90a69ab47e5418e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Reactive System Exception/ReactiveSystemExceptionController.cs
================================================
using System;
using System.Collections.Generic;
using System.Globalization;
using Entitas;
using Entitas.Unity;
using UnityEngine;
using Random = UnityEngine.Random;
public class ReactiveSystemExceptionController : MonoBehaviour
{
Game.Entity _entity;
ExceptionReactiveSystem _system;
void Start()
{
ContextInitialization.InitializeAllContexts();
var gameContext = new GameContext();
gameContext.CreateContextObserver();
_entity = gameContext.CreateEntity();
_system = new ExceptionReactiveSystem(gameContext);
}
void Update()
{
_entity.ReplaceMyString(Random.value.ToString(CultureInfo.InvariantCulture));
_system.Execute();
}
}
public class ExceptionReactiveSystem : ReactiveSystem
{
public ExceptionReactiveSystem(GameContext context) : base(context) { }
protected override ICollector GetTrigger(IContext context) =>
context.CreateCollector(GameMyStringMatcher.MyString);
protected override bool Filter(Game.Entity entity) => true;
protected override void Execute(List entities)
{
if (Random.value > 0.99f)
throw new Exception("ExceptionReactiveSystem Exception!");
}
}
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Reactive System Exception/ReactiveSystemExceptionController.cs.meta
================================================
fileFormatVersion: 2
guid: af88d9eb7bda418db410c5a1d92d419b
timeCreated: 1539714679
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/Reactive System Exception.meta
================================================
fileFormatVersion: 2
guid: 95a1991d296b43cdacda4c6f66a842e5
timeCreated: 1539714655
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/ReactiveSystem Destructor/ReactiveSystem Destructor.unity
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
SceneSettings:
m_ObjectHideFlags: 0
m_PVSData:
m_PVSObjectsArray: []
m_PVSPortalsArray: []
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 6
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 6
m_GIWorkflowMode: 0
m_LightmapsMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 3
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AOMaxDistance: 1
m_Padding: 2
m_CompAOExponent: 0
m_LightmapParameters: {fileID: 0}
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherRayCount: 1024
m_ReflectionCompression: 2
m_LightingDataAsset: {fileID: 0}
m_RuntimeCPUUsage: 25
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
accuratePlacement: 0
minRegionArea: 2
cellSize: 0.16666667
manualCellSize: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &1576095025
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1576095027}
- 114: {fileID: 1576095026}
m_Layer: 0
m_Name: Controller
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1576095026
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1576095025}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 60cd40ead19244af69139bcae307ac31, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1576095027
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1576095025}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/ReactiveSystem Destructor/ReactiveSystem Destructor.unity.meta
================================================
fileFormatVersion: 2
guid: 2c07bbb67ef0741c587e02a7ab9a476b
timeCreated: 1454969404
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/ReactiveSystem Destructor/ReactiveSystemDestructorController.cs
================================================
using Entitas.Unity;
using UnityEngine;
using UnityEditor;
public class ReactiveSystemDestructorController : MonoBehaviour
{
GameContext _gameContext;
Game.Entity _initialEntity;
void Start()
{
ContextInitialization.InitializeAllContexts();
_gameContext = new GameContext();
_gameContext.CreateContextObserver();
new TestReactiveSystem(_gameContext);
_initialEntity = _gameContext.CreateEntity();
_initialEntity.AddTest();
_initialEntity.Destroy();
}
void Update()
{
for (var i = 0; i < 5000; i++)
{
var e = _gameContext.CreateEntity();
if (e == _initialEntity)
{
Debug.Log("Success: Reusing entity!");
EditorApplication.isPlaying = false;
}
}
}
}
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/ReactiveSystem Destructor/ReactiveSystemDestructorController.cs.meta
================================================
fileFormatVersion: 2
guid: 60cd40ead19244af69139bcae307ac31
timeCreated: 1454969436
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests/ReactiveSystem Destructor.meta
================================================
fileFormatVersion: 2
guid: 5b42989fff2b74bbf9e97aa602022f12
folderAsset: yes
timeCreated: 1454969316
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests/Manual Tests.meta
================================================
fileFormatVersion: 2
guid: 8c5e0db5fd8544447bfef576d96efc55
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample/Tests.meta
================================================
fileFormatVersion: 2
guid: 403c2dea987524f5abb71c8714c790eb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Assets/Sample.meta
================================================
fileFormatVersion: 2
guid: d06c0160a13c94f329b85a954d6d6ce2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: samples/Unity/Entitas.properties
================================================
Entitas.VisualDebugging.Unity.Editor.SystemWarningThreshold = 1
Entitas.VisualDebugging.Unity.Editor.DefaultInstanceCreatorFolderPath = Assets/Editor/DefaultInstanceCreator
Entitas.VisualDebugging.Unity.Editor.TypeDrawerFolderPath = Assets/Editor/TypeDrawer
================================================
FILE: samples/Unity/Jenny.properties
================================================
Jenny.SearchPaths = ../../tests/Entitas.CodeGeneration.Program/bin/Release
Jenny.Plugins = Entitas.CodeGeneration.Plugins, \
Entitas.Roslyn.CodeGeneration.Plugins, \
Entitas.VisualDebugging.CodeGeneration.Plugins, \
Jenny.Plugins, \
Jenny.Plugins.Unity
Jenny.PreProcessors = Jenny.Plugins.ValidateProjectPathPreProcessor, \
Jenny.Plugins.TargetFrameworkProfilePreProcessor
Jenny.DataProviders = Entitas.CodeGeneration.Plugins.ContextDataProvider, \
Entitas.Roslyn.CodeGeneration.Plugins.CleanupDataProvider, \
Entitas.Roslyn.CodeGeneration.Plugins.ComponentDataProvider, \
Entitas.Roslyn.CodeGeneration.Plugins.EntityIndexDataProvider
Jenny.CodeGenerators = Entitas.CodeGeneration.Plugins.ComponentContextApiGenerator, \
Entitas.CodeGeneration.Plugins.ComponentEntityApiGenerator, \
Entitas.CodeGeneration.Plugins.ComponentEntityApiInterfaceGenerator, \
Entitas.CodeGeneration.Plugins.ComponentGenerator, \
Entitas.CodeGeneration.Plugins.ComponentLookupGenerator, \
Entitas.CodeGeneration.Plugins.ComponentMatcherApiGenerator, \
Entitas.CodeGeneration.Plugins.ContextAttributeGenerator, \
Entitas.CodeGeneration.Plugins.ContextGenerator, \
Entitas.CodeGeneration.Plugins.ContextMatcherGenerator, \
Entitas.CodeGeneration.Plugins.ContextsGenerator, \
Entitas.CodeGeneration.Plugins.EntityGenerator, \
Entitas.CodeGeneration.Plugins.EntityIndexGenerator, \
Entitas.CodeGeneration.Plugins.EventEntityApiGenerator, \
Entitas.CodeGeneration.Plugins.EventListenerComponentGenerator, \
Entitas.CodeGeneration.Plugins.EventListenerInterfaceGenerator, \
Entitas.CodeGeneration.Plugins.EventSystemGenerator, \
Entitas.CodeGeneration.Plugins.EventSystemsGenerator, \
Entitas.VisualDebugging.CodeGeneration.Plugins.ContextObserverGenerator, \
Entitas.VisualDebugging.CodeGeneration.Plugins.FeatureClassGenerator, \
Entitas.Roslyn.CodeGeneration.Plugins.CleanupSystemGenerator, \
Entitas.Roslyn.CodeGeneration.Plugins.CleanupSystemsGenerator
Jenny.PostProcessors = Jenny.Plugins.AddFileHeaderPostProcessor, \
Jenny.Plugins.CleanTargetDirectoryPostProcessor, \
Jenny.Plugins.MergeFilesPostProcessor, \
Jenny.Plugins.UpdateCsprojPostProcessor, \
Jenny.Plugins.WriteToDiskPostProcessor, \
Jenny.Plugins.ConsoleWriteLinePostProcessor
Jenny.Server.Port = 3333
Jenny.Client.Host = localhost
Jenny.Plugins.ProjectPath = Assembly-CSharp.csproj
Entitas.CodeGeneration.Plugins.Contexts = Game, \
Input
Entitas.CodeGeneration.Plugins.IgnoreNamespaces = false
Jenny.Plugins.TargetDirectory = Assets
================================================
FILE: samples/Unity/Packages/manifest.json
================================================
{
"dependencies": {
"com.unity.ide.rider": "3.0.24",
"com.unity.test-framework": "1.1.33",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.cloth": "1.0.0",
"com.unity.modules.director": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.physics2d": "1.0.0",
"com.unity.modules.screencapture": "1.0.0",
"com.unity.modules.terrain": "1.0.0",
"com.unity.modules.terrainphysics": "1.0.0",
"com.unity.modules.tilemap": "1.0.0",
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.uielements": "1.0.0",
"com.unity.modules.umbra": "1.0.0",
"com.unity.modules.unityanalytics": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
"com.unity.modules.unitywebrequestaudio": "1.0.0",
"com.unity.modules.unitywebrequesttexture": "1.0.0",
"com.unity.modules.unitywebrequestwww": "1.0.0",
"com.unity.modules.vehicles": "1.0.0",
"com.unity.modules.video": "1.0.0",
"com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
}
}
================================================
FILE: samples/Unity/Packages/packages-lock.json
================================================
{
"dependencies": {
"com.unity.ext.nunit": {
"version": "1.0.6",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.ide.rider": {
"version": "3.0.24",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.ext.nunit": "1.0.6"
},
"url": "https://packages.unity.com"
},
"com.unity.test-framework": {
"version": "1.1.33",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.ext.nunit": "1.0.6",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.modules.ai": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.androidjni": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.animation": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.assetbundle": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.audio": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.cloth": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.physics": "1.0.0"
}
},
"com.unity.modules.director": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.animation": "1.0.0"
}
},
"com.unity.modules.imageconversion": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.imgui": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.jsonserialize": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.particlesystem": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.physics": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.physics2d": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.screencapture": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.imageconversion": "1.0.0"
}
},
"com.unity.modules.subsystems": {
"version": "1.0.0",
"depth": 1,
"source": "builtin",
"dependencies": {
"com.unity.modules.jsonserialize": "1.0.0"
}
},
"com.unity.modules.terrain": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.terrainphysics": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.terrain": "1.0.0"
}
},
"com.unity.modules.tilemap": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.physics2d": "1.0.0"
}
},
"com.unity.modules.ui": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.uielements": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
}
},
"com.unity.modules.umbra": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.unityanalytics": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
}
},
"com.unity.modules.unitywebrequest": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.unitywebrequestassetbundle": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0"
}
},
"com.unity.modules.unitywebrequestaudio": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.audio": "1.0.0"
}
},
"com.unity.modules.unitywebrequesttexture": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0"
}
},
"com.unity.modules.unitywebrequestwww": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
"com.unity.modules.unitywebrequestaudio": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0"
}
},
"com.unity.modules.vehicles": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.physics": "1.0.0"
}
},
"com.unity.modules.video": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0"
}
},
"com.unity.modules.vr": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.xr": "1.0.0"
}
},
"com.unity.modules.wind": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.xr": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.subsystems": "1.0.0"
}
}
}
}
================================================
FILE: samples/Unity/ProjectSettings/AudioManager.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!11 &1
AudioManager:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Volume: 1
Rolloff Scale: 1
Doppler Factor: 1
Default Speaker Mode: 2
m_SampleRate: 0
m_DSPBufferSize: 1024
m_VirtualVoiceCount: 512
m_RealVoiceCount: 32
m_SpatializerPlugin:
m_AmbisonicDecoderPlugin:
m_DisableAudio: 0
m_VirtualizeEffects: 1
m_RequestedDSPBufferSize: 1024
================================================
FILE: samples/Unity/ProjectSettings/ClusterInputManager.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!236 &1
ClusterInputManager:
m_ObjectHideFlags: 0
m_Inputs: []
================================================
FILE: samples/Unity/ProjectSettings/DynamicsManager.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!55 &1
PhysicsManager:
m_ObjectHideFlags: 0
serializedVersion: 11
m_Gravity: {x: 0, y: -9.81, z: 0}
m_DefaultMaterial: {fileID: 0}
m_BounceThreshold: 2
m_SleepThreshold: 0.005
m_DefaultContactOffset: 0.01
m_DefaultSolverIterations: 6
m_DefaultSolverVelocityIterations: 1
m_QueriesHitBackfaces: 0
m_QueriesHitTriggers: 1
m_EnableAdaptiveForce: 0
m_ClothInterCollisionDistance: 0
m_ClothInterCollisionStiffness: 0
m_ContactsGeneration: 1
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1
m_AutoSyncTransforms: 0
m_ReuseCollisionCallbacks: 1
m_ClothInterCollisionSettingsToggle: 0
m_ContactPairsMode: 0
m_BroadphaseType: 0
m_WorldBounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 250, y: 250, z: 250}
m_WorldSubdivisions: 8
m_FrictionType: 0
m_EnableEnhancedDeterminism: 0
m_EnableUnifiedHeightmaps: 1
m_DefaultMaxAngluarSpeed: 7
================================================
FILE: samples/Unity/ProjectSettings/EditorBuildSettings.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1045 &1
EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes: []
m_configObjects: {}
================================================
FILE: samples/Unity/ProjectSettings/EditorSettings.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!159 &1
EditorSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_SerializationMode: 2
m_LineEndingsForNewScripts: 1
m_DefaultBehaviorMode: 0
m_PrefabRegularEnvironment: {fileID: 0}
m_PrefabUIEnvironment: {fileID: 0}
m_SpritePackerMode: 0
m_SpritePackerPaddingPower: 1
m_Bc7TextureCompressor: 0
m_EtcTextureCompressorBehavior: 1
m_EtcTextureFastCompressor: 1
m_EtcTextureNormalCompressor: 2
m_EtcTextureBestCompressor: 4
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref
m_ProjectGenerationRootNamespace:
m_EnableTextureStreamingInEditMode: 1
m_EnableTextureStreamingInPlayMode: 1
m_AsyncShaderCompilation: 1
m_CachingShaderPreprocessor: 1
m_PrefabModeAllowAutoSave: 1
m_EnterPlayModeOptionsEnabled: 0
m_EnterPlayModeOptions: 3
m_GameObjectNamingDigits: 1
m_GameObjectNamingScheme: 0
m_AssetNamingUsesSpace: 1
m_UseLegacyProbeSampleCount: 0
m_SerializeInlineMappingsOnOneLine: 1
m_DisableCookiesInLightmapper: 0
m_AssetPipelineMode: 1
m_RefreshImportMode: 0
m_CacheServerMode: 0
m_CacheServerEndpoint:
m_CacheServerNamespacePrefix: default
m_CacheServerEnableDownload: 1
m_CacheServerEnableUpload: 1
m_CacheServerEnableAuth: 0
m_CacheServerEnableTls: 0
================================================
FILE: samples/Unity/ProjectSettings/GraphicsSettings.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!30 &1
GraphicsSettings:
m_ObjectHideFlags: 0
serializedVersion: 13
m_Deferred:
m_Mode: 1
m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
m_DeferredReflections:
m_Mode: 1
m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0}
m_ScreenSpaceShadows:
m_Mode: 1
m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0}
m_LegacyDeferred:
m_Mode: 1
m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}
m_DepthNormals:
m_Mode: 1
m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0}
m_MotionVectors:
m_Mode: 1
m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0}
m_LightHalo:
m_Mode: 1
m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0}
m_LensFlare:
m_Mode: 1
m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0}
m_AlwaysIncludedShaders:
- {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}
m_CustomRenderPipeline: {fileID: 0}
m_TransparencySortMode: 0
m_TransparencySortAxis: {x: 0, y: 0, z: 1}
m_DefaultRenderingPath: 1
m_DefaultMobileRenderingPath: 1
m_TierSettings: []
m_LightmapStripping: 0
m_FogStripping: 0
m_InstancingStripping: 0
m_LightmapKeepPlain: 1
m_LightmapKeepDirCombined: 1
m_LightmapKeepDynamicPlain: 1
m_LightmapKeepDynamicDirCombined: 1
m_LightmapKeepShadowMask: 1
m_LightmapKeepSubtractive: 1
m_FogKeepLinear: 1
m_FogKeepExp: 1
m_FogKeepExp2: 1
m_AlbedoSwatchInfos: []
m_LightsUseLinearIntensity: 0
m_LightsUseColorTemperature: 0
m_LogWhenShaderIsCompiled: 0
m_AllowEnlightenSupportForUpgradedProject: 0
================================================
FILE: samples/Unity/ProjectSettings/InputManager.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!13 &1
InputManager:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Axes:
- serializedVersion: 3
m_Name: Horizontal
descriptiveName:
descriptiveNegativeName:
negativeButton: left
positiveButton: right
altNegativeButton: a
altPositiveButton: d
gravity: 3
dead: 0.001
sensitivity: 3
snap: 1
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Vertical
descriptiveName:
descriptiveNegativeName:
negativeButton: down
positiveButton: up
altNegativeButton: s
altPositiveButton: w
gravity: 3
dead: 0.001
sensitivity: 3
snap: 1
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire1
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left ctrl
altNegativeButton:
altPositiveButton: mouse 0
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire2
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left alt
altNegativeButton:
altPositiveButton: mouse 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire3
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left shift
altNegativeButton:
altPositiveButton: mouse 2
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Jump
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: space
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Mouse X
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Mouse Y
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 1
joyNum: 0
- serializedVersion: 3
m_Name: Mouse ScrollWheel
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 2
joyNum: 0
- serializedVersion: 3
m_Name: Horizontal
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Vertical
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 1
type: 2
axis: 1
joyNum: 0
- serializedVersion: 3
m_Name: Fire1
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 0
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire2
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 1
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire3
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 2
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Jump
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 3
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Submit
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: return
altNegativeButton:
altPositiveButton: joystick button 0
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Submit
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: enter
altNegativeButton:
altPositiveButton: space
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Cancel
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: escape
altNegativeButton:
altPositiveButton: joystick button 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
================================================
FILE: samples/Unity/ProjectSettings/MemorySettings.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!387306366 &1
MemorySettings:
m_ObjectHideFlags: 0
m_EditorMemorySettings:
m_MainAllocatorBlockSize: -1
m_ThreadAllocatorBlockSize: -1
m_MainGfxBlockSize: -1
m_ThreadGfxBlockSize: -1
m_CacheBlockSize: -1
m_TypetreeBlockSize: -1
m_ProfilerBlockSize: -1
m_ProfilerEditorBlockSize: -1
m_BucketAllocatorGranularity: -1
m_BucketAllocatorBucketsCount: -1
m_BucketAllocatorBlockSize: -1
m_BucketAllocatorBlockCount: -1
m_ProfilerBucketAllocatorGranularity: -1
m_ProfilerBucketAllocatorBucketsCount: -1
m_ProfilerBucketAllocatorBlockSize: -1
m_ProfilerBucketAllocatorBlockCount: -1
m_TempAllocatorSizeMain: -1
m_JobTempAllocatorBlockSize: -1
m_BackgroundJobTempAllocatorBlockSize: -1
m_JobTempAllocatorReducedBlockSize: -1
m_TempAllocatorSizeGIBakingWorker: -1
m_TempAllocatorSizeNavMeshWorker: -1
m_TempAllocatorSizeAudioWorker: -1
m_TempAllocatorSizeCloudWorker: -1
m_TempAllocatorSizeGfx: -1
m_TempAllocatorSizeJobWorker: -1
m_TempAllocatorSizeBackgroundWorker: -1
m_TempAllocatorSizePreloadManager: -1
m_PlatformMemorySettings: {}
================================================
FILE: samples/Unity/ProjectSettings/NavMeshAreas.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!126 &1
NavMeshProjectSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
areas:
- name: Walkable
cost: 1
- name: Not Walkable
cost: 1
- name: Jump
cost: 2
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
m_LastAgentTypeID: -887442657
m_Settings:
- serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.75
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_SettingNames:
- Humanoid
================================================
FILE: samples/Unity/ProjectSettings/PackageManagerSettings.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &1
MonoBehaviour:
m_ObjectHideFlags: 61
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_EnablePreReleasePackages: 0
m_EnablePackageDependencies: 0
m_AdvancedSettingsExpanded: 1
m_ScopedRegistriesSettingsExpanded: 1
m_SeeAllPackageVersions: 0
oneTimeWarningShown: 0
m_Registries:
- m_Id: main
m_Name:
m_Url: https://packages.unity.com
m_Scopes: []
m_IsDefault: 1
m_Capabilities: 7
m_UserSelectedRegistryName:
m_UserAddingNewScopedRegistry: 0
m_RegistryInfoDraft:
m_Modified: 0
m_ErrorMessage:
m_UserModificationsInstanceId: -830
m_OriginalInstanceId: -832
m_LoadAssets: 0
================================================
FILE: samples/Unity/ProjectSettings/Physics2DSettings.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!19 &1
Physics2DSettings:
m_ObjectHideFlags: 0
serializedVersion: 4
m_Gravity: {x: 0, y: -9.81}
m_DefaultMaterial: {fileID: 0}
m_VelocityIterations: 8
m_PositionIterations: 3
m_VelocityThreshold: 1
m_MaxLinearCorrection: 0.2
m_MaxAngularCorrection: 8
m_MaxTranslationSpeed: 100
m_MaxRotationSpeed: 360
m_BaumgarteScale: 0.2
m_BaumgarteTimeOfImpactScale: 0.75
m_TimeToSleep: 0.5
m_LinearSleepTolerance: 0.01
m_AngularSleepTolerance: 2
m_DefaultContactOffset: 0.01
m_JobOptions:
serializedVersion: 2
useMultithreading: 0
useConsistencySorting: 0
m_InterpolationPosesPerJob: 100
m_NewContactsPerJob: 30
m_CollideContactsPerJob: 100
m_ClearFlagsPerJob: 200
m_ClearBodyForcesPerJob: 200
m_SyncDiscreteFixturesPerJob: 50
m_SyncContinuousFixturesPerJob: 50
m_FindNearestContactsPerJob: 100
m_UpdateTriggerContactsPerJob: 100
m_IslandSolverCostThreshold: 100
m_IslandSolverBodyCostScale: 1
m_IslandSolverContactCostScale: 10
m_IslandSolverJointCostScale: 10
m_IslandSolverBodiesPerJob: 50
m_IslandSolverContactsPerJob: 50
m_AutoSimulation: 1
m_QueriesHitTriggers: 1
m_QueriesStartInColliders: 1
m_CallbacksOnDisable: 1
m_ReuseCollisionCallbacks: 1
m_AutoSyncTransforms: 0
m_AlwaysShowColliders: 0
m_ShowColliderSleep: 1
m_ShowColliderContacts: 0
m_ShowColliderAABB: 0
m_ContactArrowScale: 0.2
m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412}
m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432}
m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745}
m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804}
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
================================================
FILE: samples/Unity/ProjectSettings/PresetManager.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1386491679 &1
PresetManager:
m_ObjectHideFlags: 0
serializedVersion: 2
m_DefaultPresets: {}
================================================
FILE: samples/Unity/ProjectSettings/ProjectSettings.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!129 &1
PlayerSettings:
m_ObjectHideFlags: 0
serializedVersion: 23
productGUID: b98e35bd39cfe4a29bca36f0d9bf339f
AndroidProfiler: 0
AndroidFilterTouchesWhenObscured: 0
AndroidEnableSustainedPerformanceMode: 0
defaultScreenOrientation: 4
targetDevice: 2
useOnDemandResources: 0
accelerometerFrequency: 60
companyName: DefaultCompany
productName: Unity-2021.3
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
m_ShowUnitySplashScreen: 1
m_ShowUnitySplashLogo: 1
m_SplashScreenOverlayOpacity: 1
m_SplashScreenAnimation: 1
m_SplashScreenLogoStyle: 1
m_SplashScreenDrawMode: 0
m_SplashScreenBackgroundAnimationZoom: 1
m_SplashScreenLogoAnimationZoom: 1
m_SplashScreenBackgroundLandscapeAspect: 1
m_SplashScreenBackgroundPortraitAspect: 1
m_SplashScreenBackgroundLandscapeUvs:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
m_SplashScreenBackgroundPortraitUvs:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
m_SplashScreenLogos: []
m_VirtualRealitySplashScreen: {fileID: 0}
m_HolographicTrackingLossScreen: {fileID: 0}
defaultScreenWidth: 1920
defaultScreenHeight: 1080
defaultScreenWidthWeb: 960
defaultScreenHeightWeb: 600
m_StereoRenderingPath: 0
m_ActiveColorSpace: 0
m_MTRendering: 1
mipStripping: 0
numberOfMipsStripped: 0
m_StackTraceTypes: 010000000100000001000000010000000100000001000000
iosShowActivityIndicatorOnLoading: -1
androidShowActivityIndicatorOnLoading: -1
iosUseCustomAppBackgroundBehavior: 0
iosAllowHTTPDownload: 1
allowedAutorotateToPortrait: 1
allowedAutorotateToPortraitUpsideDown: 1
allowedAutorotateToLandscapeRight: 1
allowedAutorotateToLandscapeLeft: 1
useOSAutorotation: 1
use32BitDisplayBuffer: 1
preserveFramebufferAlpha: 0
disableDepthAndStencilBuffers: 0
androidStartInFullscreen: 1
androidRenderOutsideSafeArea: 1
androidUseSwappy: 1
androidBlitType: 0
androidResizableWindow: 0
androidDefaultWindowWidth: 1920
androidDefaultWindowHeight: 1080
androidMinimumWindowWidth: 400
androidMinimumWindowHeight: 300
androidFullscreenMode: 1
defaultIsNativeResolution: 1
macRetinaSupport: 1
runInBackground: 1
captureSingleScreen: 0
muteOtherAudioSources: 0
Prepare IOS For Recording: 0
Force IOS Speakers When Recording: 0
deferSystemGesturesMode: 0
hideHomeButton: 0
submitAnalytics: 1
usePlayerLog: 1
bakeCollisionMeshes: 0
forceSingleInstance: 0
useFlipModelSwapchain: 1
resizableWindow: 0
useMacAppStoreValidation: 0
macAppStoreCategory: public.app-category.games
gpuSkinning: 1
xboxPIXTextureCapture: 0
xboxEnableAvatar: 0
xboxEnableKinect: 0
xboxEnableKinectAutoTracking: 0
xboxEnableFitness: 0
visibleInBackground: 1
allowFullscreenSwitch: 1
fullscreenMode: 1
xboxSpeechDB: 0
xboxEnableHeadOrientation: 0
xboxEnableGuest: 0
xboxEnablePIXSampling: 0
metalFramebufferOnly: 0
xboxOneResolution: 0
xboxOneSResolution: 0
xboxOneXResolution: 3
xboxOneMonoLoggingLevel: 0
xboxOneLoggingLevel: 1
xboxOneDisableEsram: 0
xboxOneEnableTypeOptimization: 0
xboxOnePresentImmediateThreshold: 0
switchQueueCommandMemory: 0
switchQueueControlMemory: 16384
switchQueueComputeMemory: 262144
switchNVNShaderPoolsGranularity: 33554432
switchNVNDefaultPoolsGranularity: 16777216
switchNVNOtherPoolsGranularity: 16777216
switchNVNMaxPublicTextureIDCount: 0
switchNVNMaxPublicSamplerIDCount: 0
stadiaPresentMode: 0
stadiaTargetFramerate: 0
vulkanNumSwapchainBuffers: 3
vulkanEnableSetSRGBWrite: 0
vulkanEnablePreTransform: 1
vulkanEnableLateAcquireNextImage: 0
vulkanEnableCommandBufferRecycling: 1
m_SupportedAspectRatios:
4:3: 1
5:4: 1
16:10: 1
16:9: 1
Others: 1
bundleVersion: 0.1
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1
xboxOneDisableKinectGpuReservation: 1
xboxOneEnable7thCore: 1
vrSettings:
enable360StereoCapture: 0
isWsaHolographicRemotingEnabled: 0
enableFrameTimingStats: 0
useHDRDisplay: 0
D3DHDRBitDepth: 0
m_ColorGamuts: 00000000
targetPixelDensity: 30
resolutionScalingMode: 0
androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1
applicationIdentifier:
Standalone: com.DefaultCompany.Unity-2021.3
buildNumber:
Standalone: 0
iPhone: 0
tvOS: 0
overrideDefaultApplicationIdentifier: 0
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 22
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1
aotOptions:
stripEngineCode: 1
iPhoneStrippingLevel: 0
iPhoneScriptCallOptimization: 0
ForceInternetPermission: 0
ForceSDCardPermission: 0
CreateWallpaper: 0
APKExpansionFiles: 0
keepLoadedShadersAlive: 0
StripUnusedMeshComponents: 1
VertexChannelCompressionMask: 4054
iPhoneSdkVersion: 988
iOSTargetOSVersionString: 11.0
tvOSSdkVersion: 0
tvOSRequireExtendedGameController: 0
tvOSTargetOSVersionString: 11.0
uIPrerenderedIcon: 0
uIRequiresPersistentWiFi: 0
uIRequiresFullScreen: 1
uIStatusBarHidden: 1
uIExitOnSuspend: 0
uIStatusBarStyle: 0
appleTVSplashScreen: {fileID: 0}
appleTVSplashScreen2x: {fileID: 0}
tvOSSmallIconLayers: []
tvOSSmallIconLayers2x: []
tvOSLargeIconLayers: []
tvOSLargeIconLayers2x: []
tvOSTopShelfImageLayers: []
tvOSTopShelfImageLayers2x: []
tvOSTopShelfImageWideLayers: []
tvOSTopShelfImageWideLayers2x: []
iOSLaunchScreenType: 0
iOSLaunchScreenPortrait: {fileID: 0}
iOSLaunchScreenLandscape: {fileID: 0}
iOSLaunchScreenBackgroundColor:
serializedVersion: 2
rgba: 0
iOSLaunchScreenFillPct: 100
iOSLaunchScreenSize: 100
iOSLaunchScreenCustomXibPath:
iOSLaunchScreeniPadType: 0
iOSLaunchScreeniPadImage: {fileID: 0}
iOSLaunchScreeniPadBackgroundColor:
serializedVersion: 2
rgba: 0
iOSLaunchScreeniPadFillPct: 100
iOSLaunchScreeniPadSize: 100
iOSLaunchScreeniPadCustomXibPath:
iOSLaunchScreenCustomStoryboardPath:
iOSLaunchScreeniPadCustomStoryboardPath:
iOSDeviceRequirements: []
iOSURLSchemes: []
macOSURLSchemes: []
iOSBackgroundModes: 0
iOSMetalForceHardShadows: 0
metalEditorSupport: 1
metalAPIValidation: 1
iOSRenderExtraFrameOnPause: 0
iosCopyPluginsCodeInsteadOfSymlink: 0
appleDeveloperTeamID:
iOSManualSigningProvisioningProfileID:
tvOSManualSigningProvisioningProfileID:
iOSManualSigningProvisioningProfileType: 0
tvOSManualSigningProvisioningProfileType: 0
appleEnableAutomaticSigning: 0
iOSRequireARKit: 0
iOSAutomaticallyDetectAndAddCapabilities: 1
appleEnableProMotion: 0
shaderPrecisionModel: 0
clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea
templatePackageId: com.unity.template.3d@8.1.0
templateDefaultScene: Assets/Scenes/SampleScene.unity
useCustomMainManifest: 0
useCustomLauncherManifest: 0
useCustomMainGradleTemplate: 0
useCustomLauncherGradleManifest: 0
useCustomBaseGradleTemplate: 0
useCustomGradlePropertiesTemplate: 0
useCustomProguardFile: 0
AndroidTargetArchitectures: 1
AndroidTargetDevices: 0
AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0}
AndroidKeystoreName:
AndroidKeyaliasName:
AndroidBuildApkPerCpuArchitecture: 0
AndroidTVCompatibility: 0
AndroidIsGame: 1
AndroidEnableTango: 0
androidEnableBanner: 1
androidUseLowAccuracyLocation: 0
androidUseCustomKeystore: 0
m_AndroidBanners:
- width: 320
height: 180
banner: {fileID: 0}
androidGamepadSupportLevel: 0
chromeosInputEmulation: 1
AndroidMinifyWithR8: 0
AndroidMinifyRelease: 0
AndroidMinifyDebug: 0
AndroidValidateAppBundleSize: 1
AndroidAppBundleSizeToValidate: 150
m_BuildTargetIcons: []
m_BuildTargetPlatformIcons:
- m_BuildTarget: iPhone
m_Icons:
- m_Textures: []
m_Width: 180
m_Height: 180
m_Kind: 0
m_SubKind: iPhone
- m_Textures: []
m_Width: 120
m_Height: 120
m_Kind: 0
m_SubKind: iPhone
- m_Textures: []
m_Width: 167
m_Height: 167
m_Kind: 0
m_SubKind: iPad
- m_Textures: []
m_Width: 152
m_Height: 152
m_Kind: 0
m_SubKind: iPad
- m_Textures: []
m_Width: 76
m_Height: 76
m_Kind: 0
m_SubKind: iPad
- m_Textures: []
m_Width: 120
m_Height: 120
m_Kind: 3
m_SubKind: iPhone
- m_Textures: []
m_Width: 80
m_Height: 80
m_Kind: 3
m_SubKind: iPhone
- m_Textures: []
m_Width: 80
m_Height: 80
m_Kind: 3
m_SubKind: iPad
- m_Textures: []
m_Width: 40
m_Height: 40
m_Kind: 3
m_SubKind: iPad
- m_Textures: []
m_Width: 87
m_Height: 87
m_Kind: 1
m_SubKind: iPhone
- m_Textures: []
m_Width: 58
m_Height: 58
m_Kind: 1
m_SubKind: iPhone
- m_Textures: []
m_Width: 29
m_Height: 29
m_Kind: 1
m_SubKind: iPhone
- m_Textures: []
m_Width: 58
m_Height: 58
m_Kind: 1
m_SubKind: iPad
- m_Textures: []
m_Width: 29
m_Height: 29
m_Kind: 1
m_SubKind: iPad
- m_Textures: []
m_Width: 60
m_Height: 60
m_Kind: 2
m_SubKind: iPhone
- m_Textures: []
m_Width: 40
m_Height: 40
m_Kind: 2
m_SubKind: iPhone
- m_Textures: []
m_Width: 40
m_Height: 40
m_Kind: 2
m_SubKind: iPad
- m_Textures: []
m_Width: 20
m_Height: 20
m_Kind: 2
m_SubKind: iPad
- m_Textures: []
m_Width: 1024
m_Height: 1024
m_Kind: 4
m_SubKind: App Store
- m_BuildTarget: Android
m_Icons:
- m_Textures: []
m_Width: 432
m_Height: 432
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 324
m_Height: 324
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 216
m_Height: 216
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 162
m_Height: 162
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 108
m_Height: 108
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 81
m_Height: 81
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 192
m_Height: 192
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 144
m_Height: 144
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 96
m_Height: 96
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 72
m_Height: 72
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 48
m_Height: 48
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 36
m_Height: 36
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 192
m_Height: 192
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 144
m_Height: 144
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 96
m_Height: 96
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 72
m_Height: 72
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 48
m_Height: 48
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 36
m_Height: 36
m_Kind: 0
m_SubKind:
m_BuildTargetBatching:
- m_BuildTarget: Standalone
m_StaticBatching: 1
m_DynamicBatching: 0
- m_BuildTarget: tvOS
m_StaticBatching: 1
m_DynamicBatching: 0
- m_BuildTarget: Android
m_StaticBatching: 1
m_DynamicBatching: 0
- m_BuildTarget: iPhone
m_StaticBatching: 1
m_DynamicBatching: 0
- m_BuildTarget: WebGL
m_StaticBatching: 0
m_DynamicBatching: 0
m_BuildTargetGraphicsJobs:
- m_BuildTarget: MacStandaloneSupport
m_GraphicsJobs: 0
- m_BuildTarget: Switch
m_GraphicsJobs: 1
- m_BuildTarget: MetroSupport
m_GraphicsJobs: 1
- m_BuildTarget: AppleTVSupport
m_GraphicsJobs: 0
- m_BuildTarget: BJMSupport
m_GraphicsJobs: 1
- m_BuildTarget: LinuxStandaloneSupport
m_GraphicsJobs: 1
- m_BuildTarget: PS4Player
m_GraphicsJobs: 1
- m_BuildTarget: iOSSupport
m_GraphicsJobs: 0
- m_BuildTarget: WindowsStandaloneSupport
m_GraphicsJobs: 1
- m_BuildTarget: XboxOnePlayer
m_GraphicsJobs: 1
- m_BuildTarget: LuminSupport
m_GraphicsJobs: 0
- m_BuildTarget: AndroidPlayer
m_GraphicsJobs: 0
- m_BuildTarget: WebGLSupport
m_GraphicsJobs: 0
m_BuildTargetGraphicsJobMode:
- m_BuildTarget: PS4Player
m_GraphicsJobMode: 0
- m_BuildTarget: XboxOnePlayer
m_GraphicsJobMode: 0
m_BuildTargetGraphicsAPIs:
- m_BuildTarget: AndroidPlayer
m_APIs: 150000000b000000
m_Automatic: 1
- m_BuildTarget: iOSSupport
m_APIs: 10000000
m_Automatic: 1
- m_BuildTarget: AppleTVSupport
m_APIs: 10000000
m_Automatic: 1
- m_BuildTarget: WebGLSupport
m_APIs: 0b000000
m_Automatic: 1
m_BuildTargetVRSettings:
- m_BuildTarget: Standalone
m_Enabled: 0
m_Devices:
- Oculus
- OpenVR
openGLRequireES31: 0
openGLRequireES31AEP: 0
openGLRequireES32: 0
m_TemplateCustomTags: {}
mobileMTRendering:
Android: 1
iPhone: 1
tvOS: 1
m_BuildTargetGroupLightmapEncodingQuality:
- m_BuildTarget: Android
m_EncodingQuality: 1
- m_BuildTarget: iPhone
m_EncodingQuality: 1
- m_BuildTarget: tvOS
m_EncodingQuality: 1
m_BuildTargetGroupLightmapSettings: []
m_BuildTargetNormalMapEncoding:
- m_BuildTarget: Android
m_Encoding: 1
- m_BuildTarget: iPhone
m_Encoding: 1
- m_BuildTarget: tvOS
m_Encoding: 1
m_BuildTargetDefaultTextureCompressionFormat:
- m_BuildTarget: Android
m_Format: 3
playModeTestRunnerEnabled: 0
runPlayModeTestAsEditModeTest: 0
actionOnDotNetUnhandledException: 1
enableInternalProfiler: 0
logObjCUncaughtExceptions: 1
enableCrashReportAPI: 0
cameraUsageDescription:
locationUsageDescription:
microphoneUsageDescription:
bluetoothUsageDescription:
switchNMETAOverride:
switchNetLibKey:
switchSocketMemoryPoolSize: 6144
switchSocketAllocatorPoolSize: 128
switchSocketConcurrencyLimit: 14
switchScreenResolutionBehavior: 2
switchUseCPUProfiler: 0
switchUseGOLDLinker: 0
switchLTOSetting: 0
switchApplicationID: 0x01004b9000490000
switchNSODependencies:
switchTitleNames_0:
switchTitleNames_1:
switchTitleNames_2:
switchTitleNames_3:
switchTitleNames_4:
switchTitleNames_5:
switchTitleNames_6:
switchTitleNames_7:
switchTitleNames_8:
switchTitleNames_9:
switchTitleNames_10:
switchTitleNames_11:
switchTitleNames_12:
switchTitleNames_13:
switchTitleNames_14:
switchTitleNames_15:
switchPublisherNames_0:
switchPublisherNames_1:
switchPublisherNames_2:
switchPublisherNames_3:
switchPublisherNames_4:
switchPublisherNames_5:
switchPublisherNames_6:
switchPublisherNames_7:
switchPublisherNames_8:
switchPublisherNames_9:
switchPublisherNames_10:
switchPublisherNames_11:
switchPublisherNames_12:
switchPublisherNames_13:
switchPublisherNames_14:
switchPublisherNames_15:
switchIcons_0: {fileID: 0}
switchIcons_1: {fileID: 0}
switchIcons_2: {fileID: 0}
switchIcons_3: {fileID: 0}
switchIcons_4: {fileID: 0}
switchIcons_5: {fileID: 0}
switchIcons_6: {fileID: 0}
switchIcons_7: {fileID: 0}
switchIcons_8: {fileID: 0}
switchIcons_9: {fileID: 0}
switchIcons_10: {fileID: 0}
switchIcons_11: {fileID: 0}
switchIcons_12: {fileID: 0}
switchIcons_13: {fileID: 0}
switchIcons_14: {fileID: 0}
switchIcons_15: {fileID: 0}
switchSmallIcons_0: {fileID: 0}
switchSmallIcons_1: {fileID: 0}
switchSmallIcons_2: {fileID: 0}
switchSmallIcons_3: {fileID: 0}
switchSmallIcons_4: {fileID: 0}
switchSmallIcons_5: {fileID: 0}
switchSmallIcons_6: {fileID: 0}
switchSmallIcons_7: {fileID: 0}
switchSmallIcons_8: {fileID: 0}
switchSmallIcons_9: {fileID: 0}
switchSmallIcons_10: {fileID: 0}
switchSmallIcons_11: {fileID: 0}
switchSmallIcons_12: {fileID: 0}
switchSmallIcons_13: {fileID: 0}
switchSmallIcons_14: {fileID: 0}
switchSmallIcons_15: {fileID: 0}
switchManualHTML:
switchAccessibleURLs:
switchLegalInformation:
switchMainThreadStackSize: 1048576
switchPresenceGroupId:
switchLogoHandling: 0
switchReleaseVersion: 0
switchDisplayVersion: 1.0.0
switchStartupUserAccount: 0
switchTouchScreenUsage: 0
switchSupportedLanguagesMask: 0
switchLogoType: 0
switchApplicationErrorCodeCategory:
switchUserAccountSaveDataSize: 0
switchUserAccountSaveDataJournalSize: 0
switchApplicationAttribute: 0
switchCardSpecSize: -1
switchCardSpecClock: -1
switchRatingsMask: 0
switchRatingsInt_0: 0
switchRatingsInt_1: 0
switchRatingsInt_2: 0
switchRatingsInt_3: 0
switchRatingsInt_4: 0
switchRatingsInt_5: 0
switchRatingsInt_6: 0
switchRatingsInt_7: 0
switchRatingsInt_8: 0
switchRatingsInt_9: 0
switchRatingsInt_10: 0
switchRatingsInt_11: 0
switchRatingsInt_12: 0
switchLocalCommunicationIds_0:
switchLocalCommunicationIds_1:
switchLocalCommunicationIds_2:
switchLocalCommunicationIds_3:
switchLocalCommunicationIds_4:
switchLocalCommunicationIds_5:
switchLocalCommunicationIds_6:
switchLocalCommunicationIds_7:
switchParentalControl: 0
switchAllowsScreenshot: 1
switchAllowsVideoCapturing: 1
switchAllowsRuntimeAddOnContentInstall: 0
switchDataLossConfirmation: 0
switchUserAccountLockEnabled: 0
switchSystemResourceMemory: 16777216
switchSupportedNpadStyles: 22
switchNativeFsCacheSize: 32
switchIsHoldTypeHorizontal: 0
switchSupportedNpadCount: 8
switchSocketConfigEnabled: 0
switchTcpInitialSendBufferSize: 32
switchTcpInitialReceiveBufferSize: 64
switchTcpAutoSendBufferSizeMax: 256
switchTcpAutoReceiveBufferSizeMax: 256
switchUdpSendBufferSize: 9
switchUdpReceiveBufferSize: 42
switchSocketBufferEfficiency: 4
switchSocketInitializeEnabled: 1
switchNetworkInterfaceManagerInitializeEnabled: 1
switchPlayerConnectionEnabled: 1
switchUseNewStyleFilepaths: 0
switchUseMicroSleepForYield: 1
switchEnableRamDiskSupport: 0
switchMicroSleepForYieldTime: 25
switchRamDiskSpaceSize: 12
ps4NPAgeRating: 12
ps4NPTitleSecret:
ps4NPTrophyPackPath:
ps4ParentalLevel: 11
ps4ContentID: ED1633-NPXX51362_00-0000000000000000
ps4Category: 0
ps4MasterVersion: 01.00
ps4AppVersion: 01.00
ps4AppType: 0
ps4ParamSfxPath:
ps4VideoOutPixelFormat: 0
ps4VideoOutInitialWidth: 1920
ps4VideoOutBaseModeInitialWidth: 1920
ps4VideoOutReprojectionRate: 60
ps4PronunciationXMLPath:
ps4PronunciationSIGPath:
ps4BackgroundImagePath:
ps4StartupImagePath:
ps4StartupImagesFolder:
ps4IconImagesFolder:
ps4SaveDataImagePath:
ps4SdkOverride:
ps4BGMPath:
ps4ShareFilePath:
ps4ShareOverlayImagePath:
ps4PrivacyGuardImagePath:
ps4ExtraSceSysFile:
ps4NPtitleDatPath:
ps4RemotePlayKeyAssignment: -1
ps4RemotePlayKeyMappingDir:
ps4PlayTogetherPlayerCount: 0
ps4EnterButtonAssignment: 1
ps4ApplicationParam1: 0
ps4ApplicationParam2: 0
ps4ApplicationParam3: 0
ps4ApplicationParam4: 0
ps4DownloadDataSize: 0
ps4GarlicHeapSize: 2048
ps4ProGarlicHeapSize: 2560
playerPrefsMaxSize: 32768
ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ
ps4pnSessions: 1
ps4pnPresence: 1
ps4pnFriends: 1
ps4pnGameCustomData: 1
playerPrefsSupport: 0
enableApplicationExit: 0
resetTempFolder: 1
restrictedAudioUsageRights: 0
ps4UseResolutionFallback: 0
ps4ReprojectionSupport: 0
ps4UseAudio3dBackend: 0
ps4UseLowGarlicFragmentationMode: 1
ps4SocialScreenEnabled: 0
ps4ScriptOptimizationLevel: 0
ps4Audio3dVirtualSpeakerCount: 14
ps4attribCpuUsage: 0
ps4PatchPkgPath:
ps4PatchLatestPkgPath:
ps4PatchChangeinfoPath:
ps4PatchDayOne: 0
ps4attribUserManagement: 0
ps4attribMoveSupport: 0
ps4attrib3DSupport: 0
ps4attribShareSupport: 0
ps4attribExclusiveVR: 0
ps4disableAutoHideSplash: 0
ps4videoRecordingFeaturesUsed: 0
ps4contentSearchFeaturesUsed: 0
ps4CompatibilityPS5: 0
ps4GPU800MHz: 1
ps4attribEyeToEyeDistanceSettingVR: 0
ps4IncludedModules: []
ps4attribVROutputEnabled: 0
monoEnv:
splashScreenBackgroundSourceLandscape: {fileID: 0}
splashScreenBackgroundSourcePortrait: {fileID: 0}
blurSplashScreenBackground: 1
spritePackerPolicy:
webGLMemorySize: 16
webGLExceptionSupport: 1
webGLNameFilesAsHashes: 0
webGLDataCaching: 1
webGLDebugSymbols: 0
webGLEmscriptenArgs:
webGLModulesDirectory:
webGLTemplate: APPLICATION:Default
webGLAnalyzeBuildSize: 0
webGLUseEmbeddedResources: 0
webGLCompressionFormat: 1
webGLWasmArithmeticExceptions: 0
webGLLinkerTarget: 1
webGLThreadsSupport: 0
webGLDecompressionFallback: 0
scriptingDefineSymbols: {}
additionalCompilerArguments: {}
platformArchitecture: {}
scriptingBackend: {}
il2cppCompilerConfiguration: {}
managedStrippingLevel: {}
incrementalIl2cppBuild: {}
suppressCommonWarnings: 1
allowUnsafeCode: 0
useDeterministicCompilation: 1
enableRoslynAnalyzers: 1
additionalIl2CppArgs:
scriptingRuntimeVersion: 1
gcIncremental: 1
assemblyVersionValidation: 1
gcWBarrierValidation: 0
apiCompatibilityLevelPerPlatform: {}
m_RenderingPath: 1
m_MobileRenderingPath: 1
metroPackageName: Template_3D
metroPackageVersion:
metroCertificatePath:
metroCertificatePassword:
metroCertificateSubject:
metroCertificateIssuer:
metroCertificateNotAfter: 0000000000000000
metroApplicationDescription: Template_3D
wsaImages: {}
metroTileShortName:
metroTileShowName: 0
metroMediumTileShowName: 0
metroLargeTileShowName: 0
metroWideTileShowName: 0
metroSupportStreamingInstall: 0
metroLastRequiredScene: 0
metroDefaultTileSize: 1
metroTileForegroundText: 2
metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0}
metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, a: 1}
metroSplashScreenUseBackgroundColor: 0
platformCapabilities: {}
metroTargetDeviceFamilies: {}
metroFTAName:
metroFTAFileTypes: []
metroProtocolName:
vcxProjDefaultLanguage:
XboxOneProductId:
XboxOneUpdateKey:
XboxOneSandboxId:
XboxOneContentId:
XboxOneTitleId:
XboxOneSCId:
XboxOneGameOsOverridePath:
XboxOnePackagingOverridePath:
XboxOneAppManifestOverridePath:
XboxOneVersion: 1.0.0.0
XboxOnePackageEncryption: 0
XboxOnePackageUpdateGranularity: 2
XboxOneDescription:
XboxOneLanguage:
- enus
XboxOneCapability: []
XboxOneGameRating: {}
XboxOneIsContentPackage: 0
XboxOneEnhancedXboxCompatibilityMode: 0
XboxOneEnableGPUVariability: 1
XboxOneSockets: {}
XboxOneSplashScreen: {fileID: 0}
XboxOneAllowedProductIds: []
XboxOnePersistentLocalStorageSize: 0
XboxOneXTitleMemory: 8
XboxOneOverrideIdentityName:
XboxOneOverrideIdentityPublisher:
vrEditorSettings: {}
cloudServicesEnabled:
UNet: 1
luminIcon:
m_Name:
m_ModelFolderPath:
m_PortalFolderPath:
luminCert:
m_CertPath:
m_SignPackage: 1
luminIsChannelApp: 0
luminVersion:
m_VersionCode: 1
m_VersionName:
apiCompatibilityLevel: 6
activeInputHandler: 0
cloudProjectId:
framebufferDepthMemorylessMode: 0
qualitySettingsNames: []
projectName:
organizationId:
cloudEnabled: 0
legacyClampBlendShapeWeights: 0
playerDataPath:
forceSRGBBlit: 1
virtualTexturingSupportEnabled: 0
================================================
FILE: samples/Unity/ProjectSettings/ProjectVersion.txt
================================================
m_EditorVersion: 2022.3.0f1
m_EditorVersionWithRevision: 2022.3.0f1 (fb119bb0b476)
================================================
FILE: samples/Unity/ProjectSettings/QualitySettings.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!47 &1
QualitySettings:
m_ObjectHideFlags: 0
serializedVersion: 5
m_CurrentQuality: 5
m_QualitySettings:
- serializedVersion: 2
name: Very Low
pixelLightCount: 0
shadows: 0
shadowResolution: 0
shadowProjection: 1
shadowCascades: 1
shadowDistance: 15
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0
blendWeights: 1
textureQuality: 1
anisotropicTextures: 0
antiAliasing: 0
softParticles: 0
softVegetation: 0
realtimeReflectionProbes: 0
billboardsFaceCameraPosition: 0
vSyncCount: 0
lodBias: 0.3
maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 4
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
- serializedVersion: 2
name: Low
pixelLightCount: 0
shadows: 0
shadowResolution: 0
shadowProjection: 1
shadowCascades: 1
shadowDistance: 20
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0
blendWeights: 2
textureQuality: 0
anisotropicTextures: 0
antiAliasing: 0
softParticles: 0
softVegetation: 0
realtimeReflectionProbes: 0
billboardsFaceCameraPosition: 0
vSyncCount: 0
lodBias: 0.4
maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 16
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
- serializedVersion: 2
name: Medium
pixelLightCount: 1
shadows: 1
shadowResolution: 0
shadowProjection: 1
shadowCascades: 1
shadowDistance: 20
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0
blendWeights: 2
textureQuality: 0
anisotropicTextures: 1
antiAliasing: 0
softParticles: 0
softVegetation: 0
realtimeReflectionProbes: 0
billboardsFaceCameraPosition: 0
vSyncCount: 1
lodBias: 0.7
maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 64
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
- serializedVersion: 2
name: High
pixelLightCount: 2
shadows: 2
shadowResolution: 1
shadowProjection: 1
shadowCascades: 2
shadowDistance: 40
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1
blendWeights: 2
textureQuality: 0
anisotropicTextures: 1
antiAliasing: 0
softParticles: 0
softVegetation: 1
realtimeReflectionProbes: 1
billboardsFaceCameraPosition: 1
vSyncCount: 1
lodBias: 1
maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 256
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
- serializedVersion: 2
name: Very High
pixelLightCount: 3
shadows: 2
shadowResolution: 2
shadowProjection: 1
shadowCascades: 2
shadowDistance: 70
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1
blendWeights: 4
textureQuality: 0
anisotropicTextures: 2
antiAliasing: 2
softParticles: 1
softVegetation: 1
realtimeReflectionProbes: 1
billboardsFaceCameraPosition: 1
vSyncCount: 1
lodBias: 1.5
maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 1024
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
- serializedVersion: 2
name: Ultra
pixelLightCount: 4
shadows: 2
shadowResolution: 2
shadowProjection: 1
shadowCascades: 4
shadowDistance: 150
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1
blendWeights: 4
textureQuality: 0
anisotropicTextures: 2
antiAliasing: 2
softParticles: 1
softVegetation: 1
realtimeReflectionProbes: 1
billboardsFaceCameraPosition: 1
vSyncCount: 1
lodBias: 2
maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 4096
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
m_PerPlatformDefaultQuality:
Android: 2
Lumin: 5
Nintendo 3DS: 5
Nintendo Switch: 5
PS4: 5
PSP2: 2
Stadia: 5
Standalone: 5
WebGL: 3
Windows Store Apps: 5
XboxOne: 5
iPhone: 2
tvOS: 2
================================================
FILE: samples/Unity/ProjectSettings/TagManager.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!78 &1
TagManager:
serializedVersion: 2
tags: []
layers:
- Default
- TransparentFX
- Ignore Raycast
-
- Water
- UI
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
m_SortingLayers:
- name: Default
uniqueID: 0
locked: 0
================================================
FILE: samples/Unity/ProjectSettings/TimeManager.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!5 &1
TimeManager:
m_ObjectHideFlags: 0
Fixed Timestep: 0.02
Maximum Allowed Timestep: 0.33333334
m_TimeScale: 1
Maximum Particle Timestep: 0.03
================================================
FILE: samples/Unity/ProjectSettings/UnityConnectSettings.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!310 &1
UnityConnectSettings:
m_ObjectHideFlags: 0
serializedVersion: 1
m_Enabled: 0
m_TestMode: 0
m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events
m_EventUrl: https://cdp.cloud.unity3d.com/v1/events
m_ConfigUrl: https://config.uca.cloud.unity3d.com
m_DashboardUrl: https://dashboard.unity3d.com
m_TestInitMode: 0
CrashReportingSettings:
m_EventUrl: https://perf-events.cloud.unity3d.com
m_Enabled: 0
m_LogBufferSize: 10
m_CaptureEditorExceptions: 1
UnityPurchasingSettings:
m_Enabled: 0
m_TestMode: 0
UnityAnalyticsSettings:
m_Enabled: 0
m_TestMode: 0
m_InitializeOnStartup: 1
UnityAdsSettings:
m_Enabled: 0
m_InitializeOnStartup: 1
m_TestMode: 0
m_IosGameId:
m_AndroidGameId:
m_GameIds: {}
m_GameId:
PerformanceReportingSettings:
m_Enabled: 0
================================================
FILE: samples/Unity/ProjectSettings/VFXManager.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!937362698 &1
VFXManager:
m_ObjectHideFlags: 0
m_IndirectShader: {fileID: 0}
m_CopyBufferShader: {fileID: 0}
m_SortShader: {fileID: 0}
m_StripUpdateShader: {fileID: 0}
m_RenderPipeSettingsPath:
m_FixedTimeStep: 0.016666668
m_MaxDeltaTime: 0.05
================================================
FILE: samples/Unity/ProjectSettings/VersionControlSettings.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!890905787 &1
VersionControlSettings:
m_ObjectHideFlags: 0
m_Mode: Visible Meta Files
m_CollabEditorSettings:
inProgressEnabled: 1
================================================
FILE: samples/Unity/ProjectSettings/XRSettings.asset
================================================
{
"m_SettingKeys": [
"VR Device Disabled",
"VR Device User Alert"
],
"m_SettingValues": [
"False",
"False"
]
}
================================================
FILE: samples/Unity/restore_unity.bash
================================================
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
UNITY_PROJECTS=(samples/Unity)
declare -A PROJECTS=(
[Entitas]=Assets/Plugins
[Entitas.Generators.Attributes]=Assets/Plugins
[Entitas.Unity]=Assets/Plugins
[Entitas.Unity.Editor]=Assets/Plugins/Editor
)
for unity_project_path in "${UNITY_PROJECTS[@]}"; do
echo "Restore Entitas: ${unity_project_path}"
for project in "${!PROJECTS[@]}"; do
echo "Restore ${project}: ${unity_project_path}"
project_path="${unity_project_path}/${PROJECTS["${project}"]}"
mkdir -p "${project_path}"
rsync \
--archive \
--recursive \
--prune-empty-dirs \
--include='*/' \
--include='**/*.cs' \
--include='**/*.png' \
--include='**/*.png.meta' \
--exclude='*' \
"src/${project}" "${project_path}"
done
echo "Restore Dotfiles: ${unity_project_path}"
mkdir -p "${unity_project_path}/.sln.dotsettings/"
cp Entitas.sln.DotSettings "${unity_project_path}/$(basename "${unity_project_path}").sln.DotSettings"
cp .sln.dotsettings/*.DotSettings "${unity_project_path}/.sln.dotsettings/"
cp .editorconfig "${unity_project_path}"
done
================================================
FILE: src/Entitas/Collector/Collector.cs
================================================
using System.Collections.Generic;
using System.Linq;
namespace Entitas
{
/// A Collector can observe one or more groups from the same context
/// and collects changed entities based on the specified groupEvent.
public class Collector : ICollector where TEntity : Entity
{
/// Returns all collected entities.
/// Call collector.ClearCollectedEntities()
/// once you processed all entities.
public HashSet CollectedEntities => _collectedEntities;
/// Returns the number of all collected entities.
public int Count => _collectedEntities.Count;
readonly HashSet _collectedEntities;
readonly IGroup[] _groups;
readonly GroupEvent[] _groupEvents;
// Cache delegate to reduce gc allocations
readonly GroupChanged _onEntityDelegate;
string _toStringCache;
/// Creates a Collector and will collect changed entities
/// based on the specified groupEvent.
public Collector(IGroup group, GroupEvent groupEvent) : this(new[] { group }, new[] { groupEvent }) { }
/// Creates a Collector and will collect changed entities
/// based on the specified groupEvents.
public Collector(IGroup[] groups, GroupEvent[] groupEvents)
{
_collectedEntities = new HashSet(EntityEqualityComparer.Comparer);
_groups = groups;
_groupEvents = groupEvents;
if (groups.Length != groupEvents.Length)
{
throw new CollectorException(
$"Unbalanced count with groups ({groups.Length}) and group events ({groupEvents.Length}).",
"Group and GroupEvents count must be equal."
);
}
_onEntityDelegate = (_, entity, _, _) =>
{
if (_collectedEntities.Add(entity))
entity.Retain(this);
};
Activate();
}
/// Activates the Collector and will start collecting
/// changed entities. Collectors are activated by default.
public void Activate()
{
for (var i = 0; i < _groups.Length; i++)
{
var group = _groups[i];
var groupEvent = _groupEvents[i];
switch (groupEvent)
{
case GroupEvent.Added:
group.OnEntityAdded -= _onEntityDelegate;
group.OnEntityAdded += _onEntityDelegate;
break;
case GroupEvent.Removed:
group.OnEntityRemoved -= _onEntityDelegate;
group.OnEntityRemoved += _onEntityDelegate;
break;
case GroupEvent.AddedOrRemoved:
group.OnEntityAdded -= _onEntityDelegate;
group.OnEntityAdded += _onEntityDelegate;
group.OnEntityRemoved -= _onEntityDelegate;
group.OnEntityRemoved += _onEntityDelegate;
break;
}
}
}
/// Deactivates the Collector.
/// This will also clear all collected entities.
/// Collectors are activated by default.
public void Deactivate()
{
for (var i = 0; i < _groups.Length; i++)
{
var group = _groups[i];
group.OnEntityAdded -= _onEntityDelegate;
group.OnEntityRemoved -= _onEntityDelegate;
}
ClearCollectedEntities();
}
/// Clears all collected entities.
public void ClearCollectedEntities()
{
foreach (var entity in _collectedEntities)
entity.Release(this);
_collectedEntities.Clear();
}
public override string ToString()
{
return _toStringCache ??= "Collector(" + string.Join(", ", _groups.Select(group => group.ToString())) + ")";
}
~Collector() => Deactivate();
}
}
================================================
FILE: src/Entitas/Collector/CollectorContextExtension.cs
================================================
namespace Entitas
{
public static class CollectorContextExtension
{
/// Creates a Collector.
public static ICollector CreateCollector(
this IContext context, IMatcher matcher) where TEntity : Entity
{
return context.CreateCollector(new TriggerOnEvent(matcher, GroupEvent.Added));
}
/// Creates a Collector.
public static ICollector CreateCollector(
this IContext context, params TriggerOnEvent[] triggers) where TEntity : Entity
{
var groups = new IGroup[triggers.Length];
var groupEvents = new GroupEvent[triggers.Length];
for (var i = 0; i < triggers.Length; i++)
{
groups[i] = context.GetGroup(triggers[i].Matcher);
groupEvents[i] = triggers[i].GroupEvent;
}
return new Collector(groups, groupEvents);
}
}
}
================================================
FILE: src/Entitas/Collector/CollectorException.cs
================================================
namespace Entitas
{
public class CollectorException : EntitasException
{
public CollectorException(string message, string hint) : base(message, hint) { }
}
}
================================================
FILE: src/Entitas/Collector/ICollector.cs
================================================
using System.Collections.Generic;
namespace Entitas
{
public interface ICollector
{
int Count { get; }
void Activate();
void Deactivate();
void ClearCollectedEntities();
}
public interface ICollector : ICollector where TEntity : Entity
{
HashSet CollectedEntities { get; }
}
}
================================================
FILE: src/Entitas/Collector/TriggerOnEvent.cs
================================================
namespace Entitas
{
public struct TriggerOnEvent where TEntity : Entity
{
public readonly IMatcher Matcher;
public readonly GroupEvent GroupEvent;
public TriggerOnEvent(IMatcher matcher, GroupEvent groupEvent)
{
Matcher = matcher;
GroupEvent = groupEvent;
}
}
}
================================================
FILE: src/Entitas/Collector/TriggerOnEventMatcherExtension.cs
================================================
namespace Entitas
{
public static class TriggerOnEventMatcherExtension
{
public static TriggerOnEvent Added(this IMatcher matcher) where TEntity : Entity =>
new TriggerOnEvent(matcher, GroupEvent.Added);
public static TriggerOnEvent Removed(this IMatcher matcher) where TEntity : Entity =>
new TriggerOnEvent(matcher, GroupEvent.Removed);
public static TriggerOnEvent AddedOrRemoved(this IMatcher matcher) where TEntity : Entity =>
new TriggerOnEvent(matcher, GroupEvent.AddedOrRemoved);
}
}
================================================
FILE: src/Entitas/Context/Context.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
namespace Entitas
{
/// A context manages the lifecycle of entities and groups.
/// You can create and destroy entities and get groups of entities.
/// The preferred way to create a context is to use the generated methods
/// from the code generator, e.g. var context = new GameContext();
public class Context : IContext where TEntity : Entity
{
/// Occurs when an entity gets created.
public event ContextEntityChanged OnEntityCreated;
/// Occurs when an entity will be destroyed.
public event ContextEntityChanged OnEntityWillBeDestroyed;
/// Occurs when an entity got destroyed.
public event ContextEntityChanged OnEntityDestroyed;
/// Occurs when a group gets created for the first time.
public event ContextGroupChanged OnGroupCreated;
/// The total amount of components an entity can possibly have.
/// This value is generated by the code generator.
public int TotalComponents => _totalComponents;
/// Returns all ComponentPools. ComponentPools is used to reuse
/// removed components.
/// Removed components will be pushed to the ComponentPool.
/// Use entity.CreateComponent(index, type) to get a new or reusable
/// component from the ComponentPool.
public Stack[] ComponentPools => _componentPools;
/// The ContextInfo contains information about the context.
/// It's used to provide better error messages.
public ContextInfo ContextInfo => _contextInfo;
/// Returns the number of entities in the context.
public int Count => _entities.Count;
/// Returns the number of entities in the internal ObjectPool
/// for entities which can be reused.
public int ReusableEntitiesCount => _reusableEntities.Count;
/// Returns the number of entities that are currently retained by
/// other objects (e.g. Group, Collector, ReactiveSystem).
public int RetainedEntitiesCount => _retainedEntities.Count;
readonly int _totalComponents;
readonly Stack[] _componentPools;
readonly ContextInfo _contextInfo;
readonly Func _aercFactory;
readonly Func _entityFactory;
readonly HashSet _entities = new HashSet(EntityEqualityComparer.Comparer);
readonly Stack _reusableEntities = new Stack();
readonly HashSet _retainedEntities = new HashSet(EntityEqualityComparer.Comparer);
readonly Dictionary, IGroup> _groups = new Dictionary, IGroup>();
readonly List>[] _groupsForIndex;
readonly Dictionary _entityIndexes;
int _creationIndex;
TEntity[] _entitiesCache;
// Cache delegate to reduce gc allocations
readonly EntityComponentChanged _onEntityChangedDelegate;
readonly EntityComponentReplaced _onComponentReplacedDelegate;
readonly EntityEvent _OnEntityReleasedDelegate;
readonly EntityEvent _OnDestroyEntityDelegate;
/// The preferred way to create a context is to use the generated methods
/// from the code generator, e.g. var context = new MainContext();
public Context(int totalComponents, Func entityFactory) : this(totalComponents, 0, null, null, entityFactory) { }
/// The preferred way to create a context is to use the generated methods
/// from the code generator, e.g. var context = new GameContext();
public Context(int totalComponents, int startCreationIndex, ContextInfo contextInfo, Func aercFactory, Func entityFactory)
{
_totalComponents = totalComponents;
_creationIndex = startCreationIndex;
if (contextInfo != null)
{
_contextInfo = contextInfo;
if (contextInfo.ComponentNames.Length != totalComponents)
throw new ContextInfoException(this, contextInfo);
}
else
{
var componentNames = new string[_totalComponents];
for (var i = 0; i < componentNames.Length; i++)
componentNames[i] = "Index " + i;
_contextInfo = new ContextInfo("Unnamed Context", componentNames, null);
}
_aercFactory = aercFactory ?? SafeAERC.Delegate;
_entityFactory = entityFactory;
_groupsForIndex = new List>[totalComponents];
_componentPools = new Stack[totalComponents];
_entityIndexes = new Dictionary();
var groupChangedListPool = new Stack>>();
_onEntityChangedDelegate = (entity, index, component) =>
{
var groups = _groupsForIndex[index];
if (groups != null)
{
var events = groupChangedListPool.Count != 0
? groupChangedListPool.Pop()
: new List>();
var tEntity = (TEntity)entity;
for (var i = 0; i < groups.Count; i++)
events.Add(groups[i].HandleEntity(tEntity));
for (var i = 0; i < events.Count; i++)
events[i]?.Invoke(groups[i], tEntity, index, component);
events.Clear();
groupChangedListPool.Push(events);
}
};
_onComponentReplacedDelegate = (entity, index, previousComponent, newComponent) =>
{
var groups = _groupsForIndex[index];
if (groups != null)
for (var i = 0; i < groups.Count; i++)
groups[i].UpdateEntity((TEntity)entity, index, previousComponent, newComponent);
};
_OnEntityReleasedDelegate = entity =>
{
if (entity.IsEnabled)
throw new EntityIsNotDestroyedException($"Cannot release {entity}!");
var tEntity = (TEntity)entity;
entity.RemoveAllOnEntityReleasedHandlers();
_retainedEntities.Remove(tEntity);
_reusableEntities.Push(tEntity);
};
_OnDestroyEntityDelegate = entity =>
{
var tEntity = (TEntity)entity;
var removed = _entities.Remove(tEntity);
if (!removed)
throw new ContextDoesNotContainEntityException(
$"'{this}' cannot destroy {tEntity}!",
"This cannot happen!?!"
);
_entitiesCache = null;
OnEntityWillBeDestroyed?.Invoke(this, tEntity);
tEntity.InternalDestroy();
OnEntityDestroyed?.Invoke(this, tEntity);
if (tEntity.RetainCount == 1)
{
// Can be released immediately without
// adding to _retainedEntities
tEntity.OnEntityReleased -= _OnEntityReleasedDelegate;
_reusableEntities.Push(tEntity);
tEntity.Release(this);
tEntity.RemoveAllOnEntityReleasedHandlers();
}
else
{
_retainedEntities.Add(tEntity);
tEntity.Release(this);
}
};
}
/// Creates a new entity or gets a reusable entity from the
/// internal ObjectPool for entities.
public TEntity CreateEntity()
{
TEntity entity;
if (_reusableEntities.Count > 0)
{
entity = _reusableEntities.Pop();
entity.Reuse(_creationIndex++);
}
else
{
entity = _entityFactory();
entity.Initialize(_creationIndex++, _totalComponents, _componentPools, _contextInfo, _aercFactory(entity));
}
_entities.Add(entity);
entity.Retain(this);
_entitiesCache = null;
entity.OnComponentAdded += _onEntityChangedDelegate;
entity.OnComponentRemoved += _onEntityChangedDelegate;
entity.OnComponentReplaced += _onComponentReplacedDelegate;
entity.OnEntityReleased += _OnEntityReleasedDelegate;
entity.OnDestroyEntity += _OnDestroyEntityDelegate;
OnEntityCreated?.Invoke(this, entity);
return entity;
}
/// Destroys all entities in the context.
/// Throws an exception if there are still retained entities.
public void DestroyAllEntities()
{
var entities = GetEntities();
for (var i = 0; i < entities.Length; i++)
entities[i].Destroy();
_entities.Clear();
if (_retainedEntities.Count != 0)
throw new ContextStillHasRetainedEntitiesException(this, _retainedEntities);
}
/// Determines whether the context has the specified entity.
public bool HasEntity(TEntity entity) => _entities.Contains(entity);
/// Returns all entities which are currently in the context.
public TEntity[] GetEntities()
{
return _entitiesCache ??= _entities.ToArray();
}
/// Returns all entities matching the specified matcher.
public TEntity[] GetEntities(IMatcher matcher)
{
return GetGroup(matcher).GetEntities();
}
/// Returns a group for the specified matcher.
/// Calling context.GetGroup(matcher) with the same matcher will always
/// return the same instance of the group.
public IGroup GetGroup(IMatcher matcher)
{
if (!_groups.TryGetValue(matcher, out var group))
{
group = new Group(matcher);
var entities = GetEntities();
for (var i = 0; i < entities.Length; i++)
group.HandleEntitySilently(entities[i]);
_groups.Add(matcher, group);
for (var i = 0; i < matcher.Indexes.Length; i++)
{
var index = matcher.Indexes[i];
_groupsForIndex[index] ??= new List>();
_groupsForIndex[index].Add(group);
}
OnGroupCreated?.Invoke(this, group);
}
return group;
}
/// Adds the IEntityIndex for the specified name.
/// There can only be one IEntityIndex per name.
public void AddEntityIndex(IEntityIndex entityIndex)
{
if (_entityIndexes.ContainsKey(entityIndex.Name))
throw new ContextEntityIndexDoesAlreadyExistException(this, entityIndex.Name);
_entityIndexes.Add(entityIndex.Name, entityIndex);
}
/// Gets the IEntityIndex for the specified name.
public IEntityIndex GetEntityIndex(string name)
{
if (!_entityIndexes.TryGetValue(name, out var entityIndex))
throw new ContextEntityIndexDoesNotExistException(this, name);
return entityIndex;
}
/// Resets the creationIndex back to 0.
public void ResetCreationIndex() => _creationIndex = 0;
/// Clears the componentPool at the specified index.
public void ClearComponentPool(int index) => _componentPools[index]?.Clear();
/// Clears all componentPools.
public void ClearComponentPools()
{
for (var i = 0; i < _componentPools.Length; i++)
ClearComponentPool(i);
}
/// Resets the context (destroys all entities and
/// resets creationIndex back to 0).
public void Reset()
{
DestroyAllEntities();
ResetCreationIndex();
}
/// Removes all event handlers
/// OnEntityCreated, OnEntityWillBeDestroyed,
/// OnEntityDestroyed and OnGroupCreated
public void RemoveAllEventHandlers()
{
OnEntityCreated = null;
OnEntityWillBeDestroyed = null;
OnEntityDestroyed = null;
OnGroupCreated = null;
}
public override string ToString() => _contextInfo.Name;
}
}
================================================
FILE: src/Entitas/Context/ContextInfo.cs
================================================
using System;
namespace Entitas
{
public class ContextInfo
{
public readonly string Name;
public readonly string[] ComponentNames;
public readonly Type[] ComponentTypes;
public ContextInfo(string name, string[] componentNames, Type[] componentTypes)
{
Name = name;
ComponentNames = componentNames;
ComponentTypes = componentTypes;
}
}
}
================================================
FILE: src/Entitas/Context/Exceptions/ContextDoesNotContainEntityException.cs
================================================
namespace Entitas
{
public class ContextDoesNotContainEntityException : EntitasException
{
public ContextDoesNotContainEntityException(string message, string hint) :
base($"{message}\nContext does not contain entity!", hint) { }
}
}
================================================
FILE: src/Entitas/Context/Exceptions/ContextEntityIndexDoesAlreadyExistException.cs
================================================
namespace Entitas
{
public class ContextEntityIndexDoesAlreadyExistException : EntitasException
{
public ContextEntityIndexDoesAlreadyExistException(IContext context, string name) :
base($"Cannot add EntityIndex '{name}' to context '{context}'!",
"An EntityIndex with this name has already been added.") { }
}
}
================================================
FILE: src/Entitas/Context/Exceptions/ContextEntityIndexDoesNotExistException.cs
================================================
namespace Entitas
{
public class ContextEntityIndexDoesNotExistException : EntitasException
{
public ContextEntityIndexDoesNotExistException(IContext context, string name) :
base($"Cannot get EntityIndex '{name}' from context '{context}'!",
"No EntityIndex with this name has been added.") { }
}
}
================================================
FILE: src/Entitas/Context/Exceptions/ContextInfoException.cs
================================================
namespace Entitas
{
public class ContextInfoException : EntitasException
{
public ContextInfoException(IContext context, ContextInfo contextInfo) :
base($"Invalid ContextInfo for '{context}'!\nExpected {context.TotalComponents} ComponentName(s) but got {contextInfo.ComponentNames.Length}:",
string.Join("\n", contextInfo.ComponentNames)) { }
}
}
================================================
FILE: src/Entitas/Context/Exceptions/ContextStillHasRetainedEntitiesException.cs
================================================
using System.Collections.Generic;
using System.Linq;
namespace Entitas
{
public class ContextStillHasRetainedEntitiesException : EntitasException
{
public ContextStillHasRetainedEntitiesException(IContext context, IEnumerable entities) :
base($"'{context}' detected retained entities although all entities got destroyed!",
$"Did you release all entities? Try calling systems.DeactivateReactiveSystems() before calling context.DestroyAllEntities() to avoid memory leaks. Do not forget to activate them back when needed.\n{EntitiesToString(entities)}") { }
static string EntitiesToString(IEnumerable entities) =>
string.Join("\n", entities.Select(entity => entity.Aerc is SafeAERC safeAerc
? $"{entity} - {string.Join(", ", safeAerc.Owners.Select(o => o.ToString()))}"
: entity.ToString())
);
}
}
================================================
FILE: src/Entitas/Context/Exceptions/EntityIsNotDestroyedException.cs
================================================
namespace Entitas
{
public class EntityIsNotDestroyedException : EntitasException
{
public EntityIsNotDestroyedException(string message) :
base($"{message}\nEntity is not destroyed yet!",
"Did you manually call entity.Release(context) yourself? If so, please don\'t :)") { }
}
}
================================================
FILE: src/Entitas/Context/IContext.cs
================================================
using System.Collections.Generic;
namespace Entitas
{
public delegate void ContextEntityChanged(IContext context, Entity entity);
public delegate void ContextGroupChanged(IContext context, IGroup group);
public interface IContext
{
event ContextEntityChanged OnEntityCreated;
event ContextEntityChanged OnEntityWillBeDestroyed;
event ContextEntityChanged OnEntityDestroyed;
event ContextGroupChanged OnGroupCreated;
int TotalComponents { get; }
Stack[] ComponentPools { get; }
ContextInfo ContextInfo { get; }
int Count { get; }
int ReusableEntitiesCount { get; }
int RetainedEntitiesCount { get; }
void DestroyAllEntities();
void AddEntityIndex(IEntityIndex entityIndex);
IEntityIndex GetEntityIndex(string name);
void ResetCreationIndex();
void ClearComponentPool(int index);
void ClearComponentPools();
void RemoveAllEventHandlers();
void Reset();
}
public interface IContext : IContext where TEntity : Entity
{
TEntity CreateEntity();
bool HasEntity(TEntity entity);
TEntity[] GetEntities();
TEntity[] GetEntities(IMatcher matcher);
IGroup GetGroup(IMatcher matcher);
}
}
================================================
FILE: src/Entitas/Entitas.csproj
================================================
$(DefaultTargetFramework)
2.0.0
================================================
FILE: src/Entitas/Entitas.csproj.DotSettings
================================================
True
True
True
True
True
True
True
True
True
True
True
True
================================================
FILE: src/Entitas/EntitasException.cs
================================================
using System;
namespace Entitas
{
/// Base exception used by Entitas.
public class EntitasException : Exception
{
public EntitasException(string message, string hint) :
base(hint != null ? $"{message}\n{hint}" : message) { }
}
}
================================================
FILE: src/Entitas/Entity/Entity.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
namespace Entitas
{
public delegate void EntityComponentChanged(
Entity entity, int index, IComponent component
);
public delegate void EntityComponentReplaced(
Entity entity, int index, IComponent previousComponent, IComponent newComponent
);
public delegate void EntityEvent(Entity entity);
/// Use context.CreateEntity() to create a new entity and
/// entity.Destroy() to destroy it.
/// You can add, replace and remove IComponent to an entity.
public class Entity
{
/// Occurs when a component gets added.
/// All event handlers will be removed when
/// the entity gets destroyed by the context.
public event EntityComponentChanged OnComponentAdded;
/// Occurs when a component gets removed.
/// All event handlers will be removed when
/// the entity gets destroyed by the context.
public event EntityComponentChanged OnComponentRemoved;
/// Occurs when a component gets replaced.
/// All event handlers will be removed when
/// the entity gets destroyed by the context.
public event EntityComponentReplaced OnComponentReplaced;
/// Occurs when an entity gets released and is not retained anymore.
/// All event handlers will be removed when
/// the entity gets destroyed by the context.
public event EntityEvent OnEntityReleased;
/// Occurs when calling entity.Destroy().
/// All event handlers will be removed when
/// the entity gets destroyed by the context.
public event EntityEvent OnDestroyEntity;
/// The total amount of components an entity can possibly have.
public int TotalComponents => _totalComponents;
/// Each entity has its own unique ID which will be set by
/// the context when you create the entity.
public int Id => _id;
/// The context manages the state of an entity.
/// Active entities are enabled, destroyed entities are not.
public bool IsEnabled => _isEnabled;
/// ComponentPools is set by the context which created the entity and
/// is used to reuse removed components.
/// Removed components will be pushed to the ComponentPool.
/// Use entity.CreateComponent(index, type) to get a new or
/// reusable component from the ComponentPool.
/// Use entity.GetComponentPool(index) to get a componentPool for
/// a specific component index.
public Stack[] ComponentPools => _componentPools;
/// The ContextInfo is set by the context which created the entity and
/// contains information about the context.
/// It's used to provide better error messages.
public ContextInfo ContextInfo => _contextInfo;
/// Automatic Entity Reference Counting (AERC)
/// is used internally to prevent pooling retained entities.
/// If you use retain manually you also have to
/// release it manually at some point.
public IAERC Aerc => _aerc;
readonly List _componentBuffer;
readonly List _indexBuffer;
int _id;
bool _isEnabled;
int _totalComponents;
IComponent[] _components;
Stack[] _componentPools;
ContextInfo _contextInfo;
IAERC _aerc;
IComponent[] _componentsCache;
int[] _componentIndexesCache;
string _toStringCache;
public Entity()
{
_componentBuffer = new List();
_indexBuffer = new List();
}
public void Initialize(int creationIndex, int totalComponents, Stack[] componentPools, ContextInfo contextInfo = null, IAERC aerc = null)
{
Reuse(creationIndex);
_totalComponents = totalComponents;
_components = new IComponent[totalComponents];
_componentPools = componentPools;
_contextInfo = contextInfo ?? CreateDefaultContextInfo();
_aerc = aerc ?? new SafeAERC(this);
}
ContextInfo CreateDefaultContextInfo()
{
var componentNames = new string[TotalComponents];
for (var i = 0; i < componentNames.Length; i++)
componentNames[i] = i.ToString();
return new ContextInfo("No Context", componentNames, null);
}
public void Reuse(int id)
{
_id = id;
_isEnabled = true;
}
/// Adds a component at the specified index.
/// You can only have one component at an index.
/// Each component type must have its own constant index.
/// The preferred way is to use the
/// generated methods from the code generator.
public void AddComponent(int index, IComponent component)
{
if (!_isEnabled)
throw new EntityIsNotEnabledException($"Cannot add component '{_contextInfo.ComponentNames[index]}' to {this}!");
if (HasComponent(index))
throw new EntityAlreadyHasComponentException(index,
$"Cannot add component '{_contextInfo.ComponentNames[index]}' to {this}!",
"You should check if an entity already has the component before adding it or use entity.ReplaceComponent()."
);
_components[index] = component;
_componentsCache = null;
_componentIndexesCache = null;
_toStringCache = null;
OnComponentAdded?.Invoke(this, index, component);
}
/// Removes a component at the specified index.
/// You can only remove a component at an index if it exists.
/// The preferred way is to use the
/// generated methods from the code generator.
public void RemoveComponent(int index)
{
if (!_isEnabled)
throw new EntityIsNotEnabledException($"Cannot remove component '{_contextInfo.ComponentNames[index]}' from {this}!");
if (!HasComponent(index))
throw new EntityDoesNotHaveComponentException(index,
$"Cannot remove component '{_contextInfo.ComponentNames[index]}' from {this}!",
"You should check if an entity has the component before removing it.");
HandleComponent(index, null);
}
/// Replaces an existing component at the specified index
/// or adds it if it doesn't exist yet.
/// The preferred way is to use the
/// generated methods from the code generator.
public void ReplaceComponent(int index, IComponent component)
{
if (!_isEnabled)
throw new EntityIsNotEnabledException($"Cannot replace component '{_contextInfo.ComponentNames[index]}' on {this}!");
if (HasComponent(index))
HandleComponent(index, component);
else if (component != null)
AddComponent(index, component);
}
void HandleComponent(int index, IComponent newComponent)
{
var previousComponent = _components[index];
if (newComponent != previousComponent)
{
_components[index] = newComponent;
_componentsCache = null;
_toStringCache = null;
if (newComponent != null)
{
OnComponentReplaced?.Invoke(this, index, previousComponent, newComponent);
}
else
{
_componentIndexesCache = null;
OnComponentRemoved?.Invoke(this, index, previousComponent);
}
GetComponentPool(index).Push(previousComponent);
}
else
{
OnComponentReplaced?.Invoke(this, index, previousComponent, newComponent);
}
}
/// Returns a component at the specified index.
/// You can only get a component at an index if it exists.
/// The preferred way is to use the
/// generated methods from the code generator.
public IComponent GetComponent(int index)
{
if (!HasComponent(index))
throw new EntityDoesNotHaveComponentException(index,
$"Cannot get component '{_contextInfo.ComponentNames[index]}' from {this}!",
"You should check if an entity has the component before getting it.");
return _components[index];
}
/// Returns all added components.
public IComponent[] GetComponents()
{
if (_componentsCache == null)
{
for (var i = 0; i < _components.Length; i++)
{
var component = _components[i];
if (component != null)
_componentBuffer.Add(component);
}
_componentsCache = _componentBuffer.ToArray();
_componentBuffer.Clear();
}
return _componentsCache;
}
/// Returns all indexes of added components.
public int[] GetComponentIndexes()
{
if (_componentIndexesCache == null)
{
for (var i = 0; i < _components.Length; i++)
if (_components[i] != null)
_indexBuffer.Add(i);
_componentIndexesCache = _indexBuffer.ToArray();
_indexBuffer.Clear();
}
return _componentIndexesCache;
}
/// Determines whether this entity has a component
/// at the specified index.
public bool HasComponent(int index) => _components[index] != null;
/// Determines whether this entity has components
/// at all the specified indexes.
public bool HasComponents(int[] indexes)
{
for (var i = 0; i < indexes.Length; i++)
if (_components[indexes[i]] == null)
return false;
return true;
}
/// Determines whether this entity has a component
/// at any of the specified indexes.
public bool HasAnyComponent(int[] indexes)
{
for (var i = 0; i < indexes.Length; i++)
if (_components[indexes[i]] != null)
return true;
return false;
}
/// Determines whether this entity has any component
public bool IsEmpty()
{
for (var i = 0; i < _components.Length; i++)
if (_components[i] != null)
return false;
return true;
}
/// Removes all components.
public void RemoveAllComponents()
{
_toStringCache = null;
for (var i = 0; i < _components.Length; i++)
if (_components[i] != null)
HandleComponent(i, null);
}
/// Returns the ComponentPool for the specified component index.
/// ComponentPools is set by the context which created the entity and
/// is used to reuse removed components.
/// Removed components will be pushed to the ComponentPool.
/// Use entity.CreateComponent(index, type) to get a new or
/// reusable component from the componentPool.
public Stack GetComponentPool(int index)
{
var componentPool = _componentPools[index];
if (componentPool == null)
{
componentPool = new Stack();
_componentPools[index] = componentPool;
}
return componentPool;
}
/// Returns a new or reusable component from the ComponentPool
/// for the specified component index.
public IComponent CreateComponent(int index, Type type)
{
var componentPool = GetComponentPool(index);
return componentPool.Count > 0
? componentPool.Pop()
: (IComponent)Activator.CreateInstance(type);
}
/// Returns a new or reusable component from the ComponentPool
/// for the specified component index.
public T CreateComponent(int index) where T : new()
{
var componentPool = GetComponentPool(index);
return componentPool.Count > 0
? (T)componentPool.Pop()
: new T();
}
/// Returns the number of objects that retain this entity.
public int RetainCount => _aerc.RetainCount;
/// Retains the entity. An owner can only retain the same entity once.
/// Retain/Release is part of AERC (Automatic Entity Reference Counting)
/// and is used internally to prevent pooling retained entities.
/// If you use retain manually you also have to
/// release it manually at some point.
public void Retain(object owner) => _aerc.Retain(owner);
/// Releases the entity. An owner can only release an entity
/// if it retains it.
/// Retain/Release is part of AERC (Automatic Entity Reference Counting)
/// and is used internally to prevent pooling retained entities.
/// If you use retain manually you also have to
/// release it manually at some point.
public void Release(object owner)
{
_aerc.Release(owner);
if (_aerc.RetainCount == 0)
OnEntityReleased?.Invoke(this);
}
// Dispatches OnDestroyEntity which will start the destroy process.
public void Destroy()
{
if (!_isEnabled)
throw new EntityIsNotEnabledException($"Cannot destroy {this}!");
OnDestroyEntity?.Invoke(this);
}
// This method is used internally. Don't call it yourself.
// Use entity.Destroy();
public void InternalDestroy()
{
_isEnabled = false;
RemoveAllComponents();
OnComponentAdded = null;
OnComponentReplaced = null;
OnComponentRemoved = null;
OnDestroyEntity = null;
}
// Do not call this method manually. This method is called by the context.
public void RemoveAllOnEntityReleasedHandlers() => OnEntityReleased = null;
/// Returns a cached string to describe the entity
/// with the following format:
/// Entity_{creationIndex}(*{retainCount})({list of components})
public override string ToString()
{
return _toStringCache ??= $"Entity_{_id}({string.Join(", ", GetComponents().Select(component => component.ToString()))})";
}
}
}
================================================
FILE: src/Entitas/Entity/EntityEqualityComparer.cs
================================================
using System.Collections.Generic;
namespace Entitas
{
public class EntityEqualityComparer : IEqualityComparer where TEntity : Entity
{
public static readonly IEqualityComparer Comparer = new EntityEqualityComparer