rick_o_max
rick_o_max
CC#
Created by rick_o_max on 5/17/2023 in #help
❔ Can't catch Unity Coroutine (IEnumerator) error
I can't try-catch a Func inside an IEnumerator, is that it?
7 replies
CC#
Created by rick_o_max on 5/17/2023 in #help
❔ Can't catch Unity Coroutine (IEnumerator) error
YieldInvoke code:
public readonly Func<T, IEnumerator> Func;
public readonly T Context;

public IEnumerator YieldInvoke()
{
var awaitable = Context as IAwaitable;
if (awaitable != null)
{
awaitable.Completed = false;
}
yield return Func(Context);
if (awaitable != null)
{
awaitable.Completed = true;
}
}
public readonly Func<T, IEnumerator> Func;
public readonly T Context;

public IEnumerator YieldInvoke()
{
var awaitable = Context as IAwaitable;
if (awaitable != null)
{
awaitable.Completed = false;
}
yield return Func(Context);
if (awaitable != null)
{
awaitable.Completed = true;
}
}
7 replies
CC#
Created by rick_o_max on 5/17/2023 in #help
❔ Can't catch Unity Coroutine (IEnumerator) error
I've used this "trick" before, and it worked (not on this project):
try
{
next = enumerator.MoveNext();
}
catch (Exception e)
{
exception = e;
goto onError;
}
if (next)
{
yield return enumerator.Current;
}
try
{
next = enumerator.MoveNext();
}
catch (Exception e)
{
exception = e;
goto onError;
}
if (next)
{
yield return enumerator.Current;
}
7 replies
CC#
Created by rick_o_max on 5/17/2023 in #help
❔ Can't catch Unity Coroutine (IEnumerator) error
This is the code that runs inside the Coroutine and executes a list of actions, theorically handling any error thrown ^
7 replies
CC#
Created by rick_o_max on 5/17/2023 in #help
❔ Can't catch Unity Coroutine (IEnumerator) error
7 replies
CC#
Created by rick_o_max on 2/20/2023 in #help
❔ System.Linq.Expressions custom expression
140 replies
CC#
Created by rick_o_max on 2/20/2023 in #help
❔ System.Linq.Expressions custom expression
Actions can't use parameters or return values, which makes it even simpler
140 replies
CC#
Created by rick_o_max on 2/20/2023 in #help
❔ System.Linq.Expressions custom expression
As I said, these makes the script waits for N frames or N ticks
140 replies
CC#
Created by rick_o_max on 2/20/2023 in #help
❔ System.Linq.Expressions custom expression
Script-wise, most complicated stuff are the WAIT and WAITT keywords
140 replies
CC#
Created by rick_o_max on 2/20/2023 in #help
❔ System.Linq.Expressions custom expression
SOUND represents a sound file (WAV in Alien Anarchy)
140 replies
CC#
Created by rick_o_max on 2/20/2023 in #help
❔ System.Linq.Expressions custom expression
WALL represents the walls between two regions WAY represents a path, made of waypoints
140 replies
CC#
Created by rick_o_max on 2/20/2023 in #help
❔ System.Linq.Expressions custom expression
REGION is a convex 2D region outline (topdown)
140 replies
CC#
Created by rick_o_max on 2/20/2023 in #help
❔ System.Linq.Expressions custom expression
TEXTURE is a texture which can use a series of BITMAPs, and can be applied to walls, ceilings and floors
140 replies
CC#
Created by rick_o_max on 2/20/2023 in #help
❔ System.Linq.Expressions custom expression
BMAP is a bitmap (PCX files in Alien Anarchy)
140 replies
CC#
Created by rick_o_max on 2/20/2023 in #help
❔ System.Linq.Expressions custom expression
THING is a static object
140 replies
CC#
Created by rick_o_max on 2/20/2023 in #help
❔ System.Linq.Expressions custom expression
ACTOR is used to represent an object that can move, have animations, etc
140 replies
CC#
Created by rick_o_max on 2/20/2023 in #help
❔ System.Linq.Expressions custom expression
IFDEF, IFNDEF, ENDIF, IFELSE, DEFINE, UNDEF are compiler directives
140 replies
CC#
Created by rick_o_max on 2/20/2023 in #help
❔ System.Linq.Expressions custom expression
SKILL represents a global variable (float type), which can have its values clamped automatically (min, max)
140 replies
CC#
Created by rick_o_max on 2/20/2023 in #help
❔ System.Linq.Expressions custom expression
SYNONYM represents a "group", which can have custom fields. This synonym can be applied to any game object, so N objects can use the fields from a single synonym
140 replies
CC#
Created by rick_o_max on 2/20/2023 in #help
❔ System.Linq.Expressions custom expression
RULE is basically a local variable that receives an expression value
140 replies