Code Monkey home page Code Monkey logo

flaxapi's Introduction

Flax Editor and Flax Engine API

Build Status Gitter VS Extension Discord

Flax Engine is a high quality modern 3D game engine written in C++. From stunning graphics to powerful scripts - Flax can give everything for your games. Designed for fast workflow with many ready to use features waiting for you right now. To learn more see the website (www.flaxengine.com).

This repository contains an open source public C# API as well as full source code of the Flax Editor. Anyone is welcome to contribute or use the modified source in Flax-based games.

Features

  • Physically Based Rendering (DirectX 11, DirectX 12, Vulkan)
  • C# Scripting (C# 7.2)
  • Physics (NVIDIA PhysX)
  • Nested Prefabs
  • Terrain and foliage
  • Top Performance
  • Xbox One, Windows, PlayStation 4, Linux and UWP support
  • Global Illumination (lightmaps baking on GPU)
  • Model LODs and content streaming
  • Rich & Extensible editor
  • In-Editor Playmode
  • Node-based Materials Editor
  • Skeletal animations and skinning
  • Audio streaming
  • Advanced game deployment infrastructure
  • Virtual input with gamepads support
  • CSG Editor
  • and many more...

Development

Flax plugin for Visual Studio

Flax Visual Studio extension provides better programming workflow, scripts debugging functionality and allows to attach to running engine instance.

Info: All FlaxAPI projects use Flax Visual Studio extension by-default, it is required to install this plugin to properly run the solution.

This extension is available to download here.

Screenshots

rendering performance pbr-rendering terrain gi materials-editor editor

Licensing and Contributions

As FlaxAPI contains parts of the Flax Engine source code using it is strictly governed by the Flax Engine End User License Agreement. If you don't agree to those terms, as amended from time to time, you are not permitted to access or use Flax Engine.

We welcome any contributions to Flax Engine development through pull requests on GitHub. Most of our active development is in the master branch, so we prefer to take pull requests there (particularly for new features). We try to make sure that all new code adheres to the Flax coding standards. All contributions are governed by the terms of the EULA.

flaxapi's People

Contributors

erdroy avatar herocrab avatar jb-perrier avatar klukule avatar mafiesto4 avatar muchaszewski avatar mwiniarski avatar sauler avatar stefnotch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flaxapi's Issues

mesh.UpdateMesh while the mesh itself is selected

Issue description:

Calling mesh.UpdateMesh while the mesh is selected causes the Flax Editor to sort of crash.

[ 00:00:31.027 ]: [Info] Debug Log: UpdateMesh
[ 00:00:31.042 ]: [Warning] Exception has been thrown during . Object reference not set to an instance of an object.
Stack strace:
  at FlaxEditor.SceneGraph.ActorChildNode.get_IsActiveInHierarchy () [0x00000] in C:\Users\Stefnotch\Documents\GitHub\Flax\FlaxAPI\FlaxEditor\SceneGraph\ActorChildNode.cs:44 
  at FlaxEditor.Viewport.MainEditorGizmoViewport.RenderTaskOnBegin (FlaxEngine.Rendering.SceneRenderTask task, FlaxEngine.Rendering.GPUContext context) [0x00024] in C:\Users\Stefnotch\Documents\GitHub\Flax\FlaxAPI\FlaxEditor\Viewport\MainEditorGizmoViewport.cs:316 
  at (wrapper delegate-invoke) <Module>.invoke_void_SceneRenderTask_GPUContext(FlaxEngine.Rendering.SceneRenderTask,FlaxEngine.Rendering.GPUContext)
  at FlaxEngine.Rendering.SceneRenderTask.OnBegin (FlaxEngine.Rendering.GPUContext context) [0x00000] in C:\Users\Stefnotch\Documents\GitHub\Flax\FlaxAPI\FlaxEngine\Rendering\SceneRenderTask.cs:203 
  at FlaxEngine.Rendering.SceneRenderTask.Internal_Render (FlaxEngine.Rendering.GPUContext context) [0x00035] in C:\Users\Stefnotch\Documents\GitHub\Flax\FlaxAPI\FlaxEngine\Rendering\SceneRenderTask.cs:164 
[ 00:00:31.042 ]: [Warning] Exception has been thrown during .
Object reference not set to an instance of an object.

Steps to reproduce:

  1. Procedural Model
  2. Call the UpdateMesh function every few seconds in the Update function
  3. Start the game
  4. Click on the ModelActor
  5. Click on the ModelActor again to select the mesh
  6. Wait a bit

Minimal reproduction project:

Flax version:

0.4.6181

Debug window

Messages background have wrong scale to content
messages scale

Flax in WinForms/WP?

Is it possible to load "Flax" in my C# WinForms/WPF application and and use Flax as a control in part of a form?

AddScript button do not filters scripts by a valid type

You can see and select items that are not a valid type on the list with following error.

image
image

Steps:

  • Create new Script.
  • Edit Script. Change its type from Script to for example Actor
  • Reload Scripts (or wait for auto reload)
  • Select our new script from AddScript button
  • Exception

Input.InputText is a null terminated string

Input.InputText is a null terminated string.

Test code:

        private void Update()
        {
            string text = Input.InputText;
            if (!string.IsNullOrWhiteSpace(text))
            {
                SpawnLetter(text);
                Debug.Log(text[0] == '\0'); // True
            }
        }

Custom Editor creation

Issue description:

I have been trying to create a custom editor for an object and ran into an issue.
A NullReferenceException is being thrown by this method:

internal static CustomEditor CreateEditor(Type targetType, bool canUseRefPicker = true)

Steps to reproduce:

Editor/MyScriptEditor.cs

    public class Hi
    {
        public string test;
    }

    [CustomEditor(typeof(MyScript))]
    public class MyScriptEditor : GenericEditor
    {
        public override void Initialize(LayoutElementsContainer layout)
        {
            layout.Label("My Custom Editor", TextAlignment.Center);
            var group = layout.Group("Inner group");
            try
            {
                //Edit: As noted below, this should be a ReadOnlyValueContainer or CustomValueContainer 
                var n = new ValueContainer(typeof(Hi)) { new Hi() }; 
                layout.Object(n); // NullReferenceException
            }
            catch (Exception e)
            {
                Debug.LogError(e);
            }
            base.Initialize(group);
        }
    }

Minimal reproduction project:

Flax version:

0.4.6181

Generic Script Constructors

Issue description:

I've been trying to make something akin to constructors for generic scripts.

Steps to reproduce:

Add the following script

public class GenericScript<T> : Script
{
    public static GenericScript<T> Make()
    {
        var script = New<GenericScript<T>>();
        script.Enabled = false;

        return script;
    }

    public static GenericScript<U> Make<U>()
    {
        var script = New<GenericScript<U>>();
        script.Enabled = false;

        return script;
    }
}

Attempt to create an instance of it in some other script's Start()

// Simply crashes
var otherTest = GenericScript<Vector3>.Make();
Actor.AddScript(otherTest);
// Also just crashes
var otherTest = GenericScript<Vector3>.Make<Vector3>();
Actor.AddScript(otherTest);

It should result in Flax crashing.

Minimal reproduction project:

Flax version:

0.3.6176

Music Importing into SceneData Folder Crash

Issue description:

When importing music into a folder and then opening the folder, the FlaxEngine crashes.

Steps to reproduce:

  1. Find some music, I used a random .mp3 file
  2. Open the Content folder
  3. Drag and drop the music into the SceneData sub-folder
    image
    image
  4. Import it and wait until it's done
  5. You currently can't see the imported music, because it's in a sub-folder
  6. Open the sub-folder. Crash.

Interestingly this doesn't always happen. If it didn't crash, just delete the imported music and try again.

Minimal reproduction project:

Flax version:

0.4.6181

Cannot Open Sln

Friend,

What version of IDE you are using to develop this game?
I using Community version of Visual Studio 2017 and 2015, but cannot open solution with all projects loaded?

KT Wong

Screen.Size first OnEnable bug

Issue description:

When starting a Flax game for the first time after starting the editor, Screen.Size returns a wrong value.

Steps to reproduce:

  1. Add a script with the following code
private void OnEnable()
{
  Debug.Log("Screen Size: " + Screen.Size);
}
  1. Close Flax
  2. Start Flax
  3. Start the game - Screen Size: X:32.15 Y:9.204319
  4. Stop the game
  5. Start the game - Screen Size: X:1066 Y:428.9999

Minimal reproduction project:

Flax version:

v0.2

Another round of typos

Hey it's me again, I've found few typos when digging through generated API

  • BoxBrush's UsePerspective property should be named ScaleInLightmap (based on internal calls + summary)
  • DirectionalLight's ShadowsMode and MinimumRoughness properties have switched Internal calls corresponding with them
  • PhysicalActor doesn't have .Gen.cs counterpart (I'm not sure if it's a bug or not)
  • PointLight's ScaledRadius calls Get/SetSourceLength instead of Get/SetScaledRadius... MinimumRoughness and Color property are missing summaries (they are blank)

Not consistant OnCollisionEnter/Exit behavior

OnCollisionExit is called when Rigidbody stops overlapping another collider. OnCollisionEnter is not called again even if Exit was previously called and rigidbody is in sitting on a collider (due to gravity).
OnCollisionStay is called in that state.

Expected logic:
OnCollisionEnter - Is called once when collider begins collision with another collider
OnCollisionStay - Is called each fixed update when collider touches with another collider (One fixed update after Enter)
OnCollisionExit - Is called when collider ends collision with another collider

image

image
OnCollisionExit is not called sometimes

Snipset - Attach to rigidbody with collider

using FlaxEngine;

namespace MyProject
{
	public class Script0 : Script
	{

	    private void OnCollisionEnter(Collision c)
	    {
	        Debug.Log("OnCollisionEnter");
	    }

        private void OnCollisionStay(Collision c)
	    {
	        Debug.Log("OnCollisionStay");
	    }

	    private void OnCollisionExit(Collision c)
	    {
	        Debug.Log("OnCollisionStay");
	    }
    }
}

Changing First Scene Bug/Crash

Issue description:

The following errors may pop up

Actors Cache already contains actor Scene (Scene; 74a68a984824b4510d12589f199ad68f)!

and

Objects registry already contains object with ID=74a68a984824b4510d12589f199ad68f! Trying to register object Scene (Scene; 74a68a984824b4510d12589f199ad68f).

and

Assertion failed!
File: Engine\Scripting\ScriptingEngine.cpp
Line: 560

Expression: !obj->_id.IsValid() || _objectsDictionary.ContainsValue(obj)

Steps to reproduce:

  1. Delete the Cache folder
  2. Open the project
  3. Create a new scene
  4. Open the GameSettings
  5. Change the First Scene to that new scene
  6. Save the GameSettings
  7. Open that new scene, open the previous scene, ...

Minimal reproduction project:

Flax version:

v0.3

Plane scaling

Issue description:

When you scale a plane, the normal vector gets scaled instead of the distance. I have no idea if this is related to the negative distance or if that's a completely separate bug.

Steps to reproduce:

Plane p = new Plane(new Vector3(1, 0, 0), 10);
var result = Plane.Transform(p, Matrix.Scaling(2f, 2f, 2f));
// [A:0.5 B:0 C:0 D:10]

Minimal reproduction project:

Flax version:

0.6.6191

Message wrong signature gets executed

Signature

            private void OnCollisionStay(int c)
	    {
	        Debug.Log("OnCollisionStay" + c);
	    }

Is called with value int as 963088312 (changes every execution)

Expected result:
Do not call OnCollisionStay or ignore parameter

Signature

            private void OnCollisionStay(string c)
	    {
	        Debug.Log("OnCollisionStay" + c);
	    }

Throws an exception
image

Expected result:
Do not call OnCollisionStay or ignore parameter

Signature

            int foo= 0;

            private void OnCollisionStay(Script0 c)
	    {
	        Debug.Log("OnCollisionStay" + c.foo);
	    }
  1. Creates new default instance
  2. Changes value of foo to random integers

Expected result:
Do not call OnCollisionStay or ignore parameter or throw an exception

Signature

            int foo= 0;

            private void OnCollisionStay(Script0 c, int d)
	    {
	        Debug.Log("OnCollisionStay" + c.foo + " " + d);
	    }

Method is called (once) but all parameters are null?
image

Expected result:
Do not call OnCollisionStay or ignore parameters or throw an exception

Exception in Thread

Issue description:

I threw an exception inside a new thread. This caused the entire Flax Editor to simply crash.

[ 00:00:11.377 ]: [Info] Debug Error: Unhandled Exception: a
[ 00:00:11.387 ]: [Warning] Exception has been thrown during . a
Stack strace:
  at LeonieDesktopFrontend.Source.AnimationController+<>c.<OnEnable>b__20_0 () [0x00001] in C:\Users\Stefnotch\Documents\GitHub\School\Leonie-3D\FlaxEngine\Source\AnimationController.cs:67 
  at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Threading.ThreadHelper.ThreadStart () [0x00008] in <9c781d3eb98b4df498100896b80cbd27>:0 
[ 00:00:11.387 ]: [Warning] Exception has been thrown during .
a
[ 00:00:11.392 ]: [Info] Created graph for scene 'Scene' in 0 ms
[ 00:00:11.392 ]: [Info] Scene loaded in 66 ms
[ 00:00:11.392 ]: [Info] [PlayMode] Enter

Steps to reproduce:

Paste the following code in the OnEnable function of a script

var thread = new Thread(() =>
{
    throw new Exception("a");
});
thread.Start();

Minimal reproduction project:

Flax version:

0.4.6181

Cannot open the project

When I open FlaxAPI solution, two projects (FlaxEngine and FlaxEditor) are automatically unloaded because they are unsupported. I use Microsoft Visual Studio 2017 Community with all .NET installed and UWP support.
Is there a way I can open FlaxAPI?

ShowInEditor attribute revert value to default

Problem: When I change BallSpeed value to 100 in editor, press enter and click start simulation. Value back to 30

My code:

using System;
using System.Collections.Generic;
using FlaxEngine;

namespace Pong
{
	public class ActorBall : Script
	{
        [ShowInEditor] private float BallSpeed = 30f;
        private RigidBody rigidBody;

        private void Awake()
        {
            rigidBody = this.Actor as RigidBody;
        }
        private void FixedUpdate()
        {
            rigidBody.LinearVelocity = Vector3.Right * BallSpeed;
        }
}
}

After few compile-play cycles with diffrent code. Flax has returned to DLL compiled at the very begining

There is no really reproduction steps, but general steps what has happened with no real reproduction yet.

  • Lunch Flax with the prepared project that has a script attached to an Object Update() {Debug.Log("T");}
  • Make modifications to the script, play the game, and repeat this point multiple times. (First modification should remove Debug.Log("T") for better effect)
  • See after a few tries multiple things happen:

image New Script with default values is attached
2.
image T is logged again
3. Another reload has 50-50 chances of a crash or things will go back to normal (your current script)

  • Windows 10 64x
  • Flax 0.1.6154

Add layers and tags doesn't work

Problem:

  1. Create Blank project
  2. Create new scene
  3. Create Game Settings
  4. Create Layer And Tags Settings
  5. Assign Layer And Tags Settings to Game Settings
  6. Open Layer And Tags Settings and add new layer/tag
  7. There is no option on object what we added
  8. Restart project solving a problem

image

Wrong type on MousePosition

Hey,

I've probably found a "bug", the property MousePosition in GUI/Window.cs (line 98) is marked as bool instead of Vector2... this is also in Window.Gen.cs (line 98, 621 and 623).

I originally wanted to pull my edits but, because the edits would be in generated part of API i rejected that idea.

Adding item to list that is serialized in inspector result in low FPS

Issue description:

If an object have list that is serializable and can be displayed in the Properties window, and this window is visible (list can be retracted) high CPU spikes are produced under GUI.OnUpdate self. The more elements the higher impact.
image
The expected result would be to NOT serialize lists displayed in Properties unless they are expanded.

Steps to reproduce:
Create empty actor, attach this script. Select this actor on scene

    public class Foo : Script
    {
        public List<string> List = new List<string>();
        private void Update()
        {
            List.Add("RANDOM ITEM CONTENT");
        }
    }

NOTE: Impact is higher if object in list is more complex. For this example i have 20ms per frame of serialization time (even with 1 item in it)

Flax version:

0.3.6176

Debugger attach issue

No reproduction steps as of now, but I have managed to corrupt my project to have 100% reproduction

Attach to Flax returns this error amount of files you have in the project.

image

Debugging is imposible for filles (all files?) that has thrown this error. I have only one instance of VS open.

Programatically reimporting ContentItems

Issue description:

I attempted to automatically reimport files when their source file changes. However, sometimes, I was faced with the following error:

Assertion failed!
File: Engine\Content\Storage\FlaxStorage.cpp
Line: 1057

Expression: _chunksLock == 0

Steps to reproduce:

It's a bit hard to reproduce; usually it takes quite a number of edits in various files until the error occurs.

Also, after the error happens, this happens when I try to clean up the temporary files I created:
image

The following code seems to cause it.

BinaryAssetItem item = Editor.ContentDatabase.Find(SOMEPATH) as BinaryAssetItem;
if (FlaxEngine.Content.Load(item.ID) is BinaryAsset test)
{
    test.WaitForLoaded();
    test.Reimport();
}

Minimal reproduction project:

https://github.com/stefnotch/flax-auto-import-resources-plugin

Flax version: v0.2

Launcher XSS

Issue description:

The Flax Launcher doesn't escape user input. For example document.getElementById('projects-content').innerHTML = generatedHtml; where generatedHTML includes the project name.

Steps to reproduce:

  1. Create a new project
  2. Edit the Project.xml to include the following
<Project>
	<Name>ZZXXMyProject'&lt;br&gt;hi&lt;br&gt;&lt;img width=150 src=&quot;https://images.pexels.com/photos/20787/pexels-photo.jpg?auto=compress&amp;cs=tinysrgb&amp;dpr=1&amp;w=500&quot;&gt;</Name>
  1. Open the Flax launcher and stare at the cute cat picture.

There are various tools to save you the trouble of manually encoding HTML.

Additional information:
This can be abused by getting someone else to download your project. For example, by uploading your project to GitHub and advertising it on Reddit.

Then, the attacker could trivially inject JavaScript into the Launcher and do potentially undesired things.

The easiest way to pull this attack off is by editing the <Name>ProjectName</Name>
Examples Names:
alert(1)

&lt;img onload=&quot;alert(1)&quot;

src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAAADUlEQVQYV2P4//8/AwAI/AL+iF8G4AAAAABJRU5ErkJggg==&quot; &gt;

Replace the page

&lt;img onload=&quot;document.body.innerHTML = &apos;&lt;h1 style=color:white&gt;Haha&apos; + document.cookie + &apos;&lt;/h1&gt;&apos;&quot; 
src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAAADUlEQVQYV2P4//8/AwAI/AL+iF8G4AAAAABJRU5ErkJggg==&quot; &gt;

Minimal reproduction project:

MyProject66.zip

Flax version:

0.4.6181

External libraries throwing exceptions that are cached crach the engine

Using external library that throws (internal) exception is cached by default exeption handler, but when try-catched sometimes it thorws following exception

Library used DotNetZip downloaded by nuget manager

try
{
	CreateDocumentationZipFile(0, "Zip", new List<string>()
	{
		"Not existing"
	});
}
catch (Exception e)
{
	Debug.LogException(e);
	throw;
}


public bool CreateDocumentationZipFile(int documentIdentifier, string zipDestinationPath, IList<string> documentPaths)
{
	bool zipped = false;

	if (documentPaths.Count > 0)
	{
		using (ZipFile loanZip = new ZipFile())
		{
			loanZip.AddFiles(documentPaths, false, "");
			loanZip.Save(string.Format("{0}{1}.zip", zipDestinationPath, documentIdentifier.ToString()));
			zipped = true;
		}
	}

	return zipped;
}

image

[ 00:02:58.447 ]: [Warning] Managed stack trace:
[ 00:02:58.447 ]: [Warning]   at System.Diagnostics.StackTrace.get_trace (System.Exception , System.Int32 , System.Boolean ) [0x00000] in <ee9b80546f454fd48a31a390370231ef>:0 
  at System.Diagnostics.StackTrace..ctor (System.Exception e, System.Int32 skipFrames, System.Boolean fNeedFileInfo) [0x00000] in <ee9b80546f454fd48a31a390370231ef>:0 
  at System.Diagnostics.StackTrace..ctor (System.Exception e, System.Boolean fNeedFileInfo) [0x00000] in <ee9b80546f454fd48a31a390370231ef>:0 
  at System.Environment.GetStackTrace (System.Exception e, System.Boolean needFileInfo) [0x00000] in <ee9b80546f454fd48a31a390370231ef>:0 
  at System.Exception.GetStackTrace (System.Boolean needFileInfo) [0x00000] in <ee9b80546f454fd48a31a390370231ef>:0 
  at System.Exception.get_StackTrace () [0x00000] in <ee9b80546f454fd48a31a390370231ef>:0 
  at FlaxEngine.DebugLogHandler.Internal_LogException (System.Exception , System.IntPtr ) [0x00000] in <06a405b350294049a3875ca581d49e36>:0 
  at FlaxEngine.DebugLogHandler.LogException (System.Exception exception, FlaxEngine.Object context) [0x00000] in C:\C_Procjects\Flax\SourceAPI\FlaxEngine\Internals\DebugLogHandler.cs:24 
  at FlaxEngine.Logger.LogException (System.Exception exception) [0x00008] in C:\C_Procjects\Flax\SourceAPI\FlaxEngine\Engine\Logger.cs:189 
  at FlaxEngine.DebugLogHandler.Internal_SendLogException (System.Exception exception) [0x00000] in C:\C_Procjects\Flax\SourceAPI\FlaxEngine\Internals\DebugLogHandler.cs:48 
[ 00:02:58.447 ]: [Warning] Message: mono_class_from_mono_type: implement me 0x67
 | Domain: Root
[ 00:02:58.447 ]: [Warning] Managed stack trace:
[ 00:02:58.447 ]: [Warning]   at System.Diagnostics.StackTrace.get_trace (System.Exception , System.Int32 , System.Boolean ) [0x00000] in <ee9b80546f454fd48a31a390370231ef>:0 
  at System.Diagnostics.StackTrace..ctor (System.Exception e, System.Int32 skipFrames, System.Boolean fNeedFileInfo) [0x00000] in <ee9b80546f454fd48a31a390370231ef>:0 
  at System.Diagnostics.StackTrace..ctor (System.Exception e, System.Boolean fNeedFileInfo) [0x00000] in <ee9b80546f454fd48a31a390370231ef>:0 
  at System.Environment.GetStackTrace (System.Exception e, System.Boolean needFileInfo) [0x00000] in <ee9b80546f454fd48a31a390370231ef>:0 
  at System.Exception.GetStackTrace (System.Boolean needFileInfo) [0x00000] in <ee9b80546f454fd48a31a390370231ef>:0 
  at System.Exception.get_StackTrace () [0x00000] in <ee9b80546f454fd48a31a390370231ef>:0 
  at FlaxEngine.DebugLogHandler.Internal_LogException (System.Exception , System.IntPtr ) [0x00000] in <06a405b350294049a3875ca581d49e36>:0 
  at FlaxEngine.DebugLogHandler.LogException (System.Exception exception, FlaxEngine.Object context) [0x00000] in C:\C_Procjects\Flax\SourceAPI\FlaxEngine\Internals\DebugLogHandler.cs:24 
  at FlaxEngine.Logger.LogException (System.Exception exception) [0x00008] in C:\C_Procjects\Flax\SourceAPI\FlaxEngine\Engine\Logger.cs:189 
  at FlaxEngine.DebugLogHandler.Internal_SendLogException (System.Exception exception) [0x00000] in C:\C_Procjects\Flax\SourceAPI\FlaxEngine\Internals\DebugLogHandler.cs:48 
[ 00:02:58.447 ]: [Error] Current Mono CLR method has thrown an inner exception 

 Additional info: Message: * Assertion: should not be reached at ..\mono\metadata\class.c:6441
 | Domain: Root

Profiler Timeline drawing text outside its bounding box

Issue description:

When scrolling Profiler, text elements from timeline are displayed if they go out of bound in top right corner
image
image

Steps to reproduce:

Run profiler with elements that can be scrooled outside timeline window and scrolling is required.
Scroll down

Minimal reproduction project:

Flax version:

Flax 0.3.6176

RigidBody-Prefab.IsActive crash

Found a (prefabs-physics?) bug that results in a crash.

Steps to reproduce:

  1. Create a prefab with a RigidBody and a BoxCollider
  2. Create a script that spawns the prefab every once in a while and messes around with IsActive.

Test code:

Actor spawned = PrefabManager.SpawnPrefab(SomePrefab, Actor);
spawned.IsActive = false;
spawned.IsActive = true;

Add building instructions

Issue description:

It'd be neat to add "building instructions" in a file like BUILDING.md

Here are mine

  1. Install the FlaxEngine Tools for Visual Studio
  2. Clone the FlaxAPI
  3. Open the FlaxAPI.sln file using Visual Studio and edit the FlaxEngine Project Properties as follows:
    image
  4. Click on Attach to Flax. This starts Flax or attaches to the current Flax instance.

float to int (and similar) casting

When changing the type of a serialized variable to a different one, it might be nice if Flax attempted to convert them.

e.g. I changed a float to an int

Exception has been thrown during ManagedSerialization::Deserialize.
Input string '30.9876175' is not a valid integer. Path 'Count', line 1, position 136.

JSON Serializing private field from base class

Issue description:

I'm not entirely sure if this is an issue or works as intended ™️ .

Anyways, I was using the FlaxEngine JSON serialisation and attempted to serialize a private field from the base class. To my surprise, this didn't work.

(After a bit of digging, it seems that this GetFields call right here doesn't return private fields from the base class)

Steps to reproduce:

[Serializable]
public class BaseClass
{
    [Serialize]
    private string _wellHidden = "you won't find me";
}

[Serializable]
public class DerivedClass : BaseClass
{
    [Serialize]
    private string _derivedHidden = "you might find me, I'm in the derived class";

    public string VeryPublic = "easy to find";

    [NoSerialize]
    public string NotSerialized = "not serialized";
}

and

Debug.LogError(FlaxEngine.Json.JsonSerializer.Serialize(new BaseClass()));
/* Outputs
{
	"_wellHidden": "you won't find me"
}
*/


Debug.LogError(FlaxEngine.Json.JsonSerializer.Serialize(new DerivedClass()));
/* Outputs, note how _wellHidden does not show up here:
{
	"_derivedHidden": "you might find me, I'm in the derived class",
	"VeryPublic": "easy to find"
}
*/

Minimal reproduction project:

Flax version:

0.4.6181

"Not supported operating system version."

Issue description:

When attempting to open a project with Flax, the error message Not supported operating system version. pops up

Steps to reproduce:

  1. Go to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion (system registry)
  2. Change the values of CurrentMajorVersionNumber and CurrentMinorVersionNumber to 0
  3. Restart the PC
  4. Attempt to open a Flax Project

Minimal reproduction project:

Flax version:

v0.3

Change is script type if script is attached results in a crash

  • Create new Script.
  • Attach the script to object in the scene within its properties
  • Edit Script. Change its type from Script to for example Actor
  • Reload Scripts (or wait for auto reload)
  • Select object in the scene that we had attached our script to.
  • Crash 100%
  • Windows 10 64x
  • Flax 0.1

Beta Release

Hi,
Excellent work on your engine, I'm also working on .NET game engine with Vulkan, DirectX12 and Metal, probably will emulate some next gen rendering features (like CommandBuffer) on OpenGL for mobile, the engine is here https://github.com/amerkoleci/Alimer and I will start to commit code from my private repository there.

Any plan to have some beta/WIP release?
I saw you've done lot of job but at the moment is not possible to test anything.

Thanks,
Amer

UI Control selection outline

Issue description:

It'd be nice if UI controls had a green outline when selecting them. Especially panels, since they are invisible by default.

Steps to reproduce:

Add a new panel. You can't see it.

To visualize what it looks like, you have to manually change the background color.

image

Minimal reproduction project:

Flax version:

0.4.6181

Spawning temporary actors with [ExecuteInEditMode]

I wrote a little script to spawn a bunch of (temporary) prefab actors. It spawns them OnEnable and destroys them OnDisable. So far, everything worked beautifully.

However, after adding [ExecuteInEditMode] to it, things broke down. It spawned actors without removing them. This might be a bug?

Also, a quick fix is using [Serialize].

[ExecuteInEditMode]
public class TenSpawner : Script
{
	public Prefab PrefabToSpawn { get; set; }
	public int Count = 10;
	
        // Quick fix
	// [Serialize]
	private Actor _container;

	private void OnEnable()
	{
		// Safety check
		if (PrefabToSpawn == null) return;
		
		// Create a new container/reuse the existing one
		if (_container == null)
		{
			_container = New<EmptyActor>();
			this.Actor.AddChild(_container, false);
		}
		else
		{
			_container.DestroyChildren();
		}

		// Add a bunch of children to it
		for (int i = 0; i < Count; i++)
		{
			var spawnedActor = PrefabManager.SpawnPrefab(PrefabToSpawn, _container);
		}
	}

	private void OnDisable()
	{
		// Clean up after yourself
		Destroy(_container);
	}
}

Create new project window

Problem: Path doesn't update when you change project name.
Expected behaviour: Update project path when you change project name.
image

`ScreenToClient` with scaling bug

ScreenToClient returns the wrong result when a control is scaled.

I created 2 UIControls (buttons) and scaled one of them. If the scale is 1,1, everything is fine, otherwise, the results are messed up.

public class Screen2ClientBug : Script
    {
        public UIControl ScaledControl;
        private Button _buttWithScale;

        public UIControl ScreenMousePosGrabber;
        private Button _screenMousePosButt;

        private void Start()
        {
            _buttWithScale = ScaledControl.Get<Button>();
            _screenMousePosButt = ScreenMousePosGrabber.Get<Button>();
        }

        private void Update()
        {
           //Both control's positions are (0,0), so this works perfectly fine
            var n = _screenMousePosButt.ClientToScreen(Input.MousePosition);

            _buttWithScale.Text = _buttWithScale.ScreenToClient(n).ToString();
        }
    }

Missing DLLs

Issue description:

I just tried out WebSockets again, it looks like there is an issue with a missing DLL?

Steps to reproduce:

// All certificates are now valid
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;

// WebSocket
var x = new ClientWebSocket();
x.ConnectAsync(new Uri("wss://echo.websocket.org"), new System.Threading.CancellationTokenSource().Token);
  1. Use the Game Cooker to build the project.
  2. Start the built .exe
  3. Check out the logs %localappdata%/<Company Name>/<Project Name>/Logs

Running the project in the editor and checking out the Logs folder also works.

Example

[ 00:00:02.714 ]: [Warning] Managed stack trace:
[ 00:00:02.714 ]: [Warning]   at System.Platform.get_IsMacOS () [0x00000] in <ea76b420f6684644b46574e5fa70c83b>:0 
  at Mono.Net.Security.MonoTlsProviderFactory.PopulateProviders () [0x00000] in <ea76b420f6684644b46574e5fa70c83b>:0 
  at Mono.Net.Security.MonoTlsProviderFactory.InitializeProviderRegistration () [0x00000] in <ea76b420f6684644b46574e5fa70c83b>:0 
  at Mono.Net.Security.MonoTlsProviderFactory.InitializeInternal () [0x00000] in <ea76b420f6684644b46574e5fa70c83b>:0 
  at Mono.Net.Security.MonoTlsProviderFactory.GetProviderInternal () [0x00000] in <ea76b420f6684644b46574e5fa70c83b>:0 
  at Mono.Net.Security.MonoTlsProviderFactory.GetProvider () [0x00000] in <ea76b420f6684644b46574e5fa70c83b>:0 
  at Mono.Net.Security.NoReflectionHelper.GetProvider () [0x00000] in <ea76b420f6684644b46574e5fa70c83b>:0 
  at Mono.Security.Interface.MonoTlsProviderFactory.GetProvider () [0x00000] in <87d58b7866bf4dc09ea9c4f72f2bd7b7>:0 
  at System.Net.Security.SslStream.GetProvider () [0x00000] in <ea76b420f6684644b46574e5fa70c83b>:0 
  at System.Net.Security.SslStream..ctor (System.IO.Stream innerStream, System.Boolean leaveInnerStreamOpen, System.Net.Security.RemoteCertificateValidationCallback userCertificateValidationCallback, System.Net.Security.LocalCertificateSelectionCallback userCertificateSelectionCallback) [0x00000] in <ea76b420f6684644b46574e5fa70c83b>:0 
  at Ninja.WebSockets.WebSocketClientFactory.GetStream (System.Guid guid, System.Net.Sockets.TcpClient tcpClient, System.Boolean isSecure, System.String host) [0x00000] in <506de8ca0d094c539f76896c7ef9e48c>:0 
  at Ninja.WebSockets.WebSocketClientFactory+<ConnectAsync>d__5.MoveNext () [0x00000] in <506de8ca0d094c539f76896c7ef9e48c>:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext (System.Object stateMachine) [0x00000] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action action, System.Boolean allowInlining, System.Threading.Tasks.Task& currentTask) [0x00000] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Threading.Tasks.Task.FinishContinuations () [0x00000] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Threading.Tasks.Task.FinishStageThree () [0x00000] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Threading.Tasks.Task`1[TResult].TrySetResult (TResult result) [0x00000] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x00000] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Threading.Tasks.TaskFactory`1+<>c__DisplayClass41_1`2[TResult,TArg1,TArg2].<FromAsyncImpl>b__1 (System.IAsyncResult iar) [0x00000] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Net.Sockets.SocketAsyncResult+<>c.<Complete>b__27_0 (System.Object state) [0x00000] in <ea76b420f6684644b46574e5fa70c83b>:0 
  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00000] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00000] in <9c781d3eb98b4df498100896b80cbd27>:0 
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <9c781d3eb98b4df498100896b80cbd27>:0 
[ 00:00:02.714 ]: [Warning] Message: DllImport unable to load library 'The system cannot find the file specified.
'. | Domain: Mono

Minimal reproduction project:

See below

Flax version:

0.4.6180

High amount of Debug logs reduces performance

Issue description:

When there is huge amount of logs the Debugger window is slowing down whole editor. If the window is not visible (active) performance goes back to normal

Steps to reproduce:

Create huge amount of text reach logs

Flax version:

0.3.6176

Script Destroy this

Issue description:

I tried to create a script that destroys itself after completing it's task

Steps to reproduce:

Apparently this causes a silent crash. If you add the Enabled = false line, it seems to work.

public class Script0 : Script 
{
private void Start()
{
	//Enabled = false; // Can apparently prevent the crash
	Destroy(this);
}
private void Update()
{
	// Without "Update" Flax doesn't crash either
}
// It might also be possible to cause this by adding OnDisable() and whatnot
}

Minimal reproduction project:

Flax version:

0.3.6176

Debug timestamps

Debug Logs should have timestamp (as present in logfile already)

Current
image
Expected
image

AddRelativeForce (0,0,0) without a collider moves the object

Issue description:

I created a Rigidbody without a collider, created a script to move it, started the game (realized that I forgot the collider) and noticed that it exhibits a strange behaviour. Pretty sure that it's not supposed to start flying around like that.

2019-02-11_16-49-40

Steps to reproduce:

public class ShipController : Script
{
  public RigidBody Ship; // Make sure that this rigidbody doesn't have a collider
  private void FixedUpdate()
  {
    Ship.AddRelativeForce(new Vector3(0, 0, 0));
  }
}

Minimal reproduction project:

Flax version:

0.3.6176

try-catched exceptions are cached multiple times

When throwing an exception its cached internally even if manually try-catched

try
{
	throw new Exception("E");
}
catch (Exception e)
{
	Debug.LogException(e);
}

image
image

Expected result:
The exception is only displayed once on LogException debug log.

TextRender only displaying a part of the string

I'm not sure if this is a bug with Flax or if I just messed up something.

Anyways, I just modified https://github.com/stefnotch/keyboard-letters-game to "properly" handle multiple keys being pressed at the same time. However, the TextRender doesn't seem to always cooperate. It quite frequently messes up and only shows one or 2 keys instead of all of them.
e.g. Something like FxEg instead of FlaxEngine. Or, w instead of aw.

To reproduce:

  1. Download the latest code ( https://github.com/stefnotch/keyboard-letters-game )
  2. Open it with Flax
  3. Play around with it
  4. Make sure your keyboard can actually handle multiple keys being pressed at the same time (keyboard rollover)
  5. Spam a lot of keys at the same time
  6. Bug should occur.

Screenshot:

image
As you can see, the code is setting "WADS" as the string, however only "WAD" gets displayed.

Main Editor Viewport Invisible Something

In the main editor window, where you can look at the scene and edit it, there seems to be a small, invisible something. The approximate location of it has been marked in the image:
image

When you right click there, instead of being able to drag the scene, nothing happens.

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.