public void TestRegisterSolverCallback() { Flex.Library lib = Flex.Init(Flex.FLEX_VERSION, ErrorCallback); Flex.SolverDesc desc = default(Flex.SolverDesc); Flex.SetSolverDescDefaults(ref desc); desc.maxParticles = 1000; desc.maxDiffuseParticles = 1000; Flex.Solver solver = Flex.CreateSolver(lib, ref desc); Flex.SolverCallback callback; callback.userData = new IntPtr(1); callback.function = (p) => { Assert.AreEqual(callback.userData, p.userData); }; Flex.SolverCallback oldCallback = Flex.RegisterSolverCallback(solver, callback, Flex.SolverCallbackStage.SubstepBegin); Assert.AreNotEqual(callback.userData, oldCallback.userData); Flex.DestroySolver(solver); Flex.Shutdown(lib); }