MelonJS debug mode - melonjs

I'm using melonJS ( v3.x ) to develop my HTML5 game.
All is working fine in debug mode ( http://something:8000/#debug ), but if i test without de debug panel ( http://something:8000/ ), my scene is loaded and rendered but none of my events work ( keyBind, pointerBind etc..).
I have no idea from where the problem can come. I have no error in my logs, neither in my firebug. Again, all is working great in debug mode.. Any help ?
EDIT
My events also work fine, they are fired when called. The problem seems to come from the scene that is never updated...

Sounds like you are missing return true in your update methods. When an entity wants melonJS to render the scene, it should return true. This "repaint signal" is not sent by default, so that it can be used to optimize repaints when nothing in the scene is animating.
The debug panel itself will return true every frame from its update method.

Related

UI element updates does not work when purchase completed - Google billing client 4

I have changed over to Google billing client 4.0 library. Since then when purchase is completed, my ui elements updates does not work.
I was trying to check if they are not in UThread anymore or something, but it is not working properly still.
billingClient!!.acknowledgePurchase(
acknowledgePurchaseParams
) { billingResult ->
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
saveSubscription(purchase.purchaseToken, sku)
mainAct?.runOnUiThread {
Toast.makeText(context , "Vásárlás sikeres", Toast.LENGTH_SHORT)
.show()
delegate?.purchaseSuccess(
actProduct,
prevProduct,
purchase.purchaseToken
)
}
}
}
When the acknowledge is done, my UI elements should be updated. There is a menu item should be enabled and in the purchase page a textfield should show that the item is purchased. The code is running, but the UI elements are not updated.
Once I move to a different fragment, the menu item turns to enabled, so it seems to me that somehow the UI is not refreshed.
In the code mainAct is the context to the MainActivity.
Any idea?
The code was running properly on Billing library 3.0.3 and runOnUIThread was not needed at all.
Still getting weird behaviour with this library. I was setting up the billing at the same time as my users log in to the app and go from the login page to the first fragment. This fragment has a recyclerview and this recycler view was filled with data from the web. The recycler view was randomly not showing the elements, even if they were loaded and the adapter was properly updated.
One you moved to another fragment and back the recycler view was showing the data properly.
As I said, the first time call when the billing server is approached the UIThread is messed up and even if data labels or menus are updated, the updates were not showed.
So something is definitely wrong with this library.
Any idea?
This behaviour is a bit weird. The documentation is saying the most of the billing library functions can be run from any thread. Only few needs to be run on UIThread. AcknowlegdePurchase should be running on AnyThread.
I have put the Toasts into runOnUIThread and the inside the delegate functions all commands I have also put inside a runOnUIThread closure.
Now it works as on billing library 3.0.3. But the documentation was not telling anything about any of these changes, so it is really unclear, why the behaviour has changed that much between the two libraries.

Scene rendering goes dark after calling LoadScene/LoadLevel [duplicate]

I completed Unity's roll-a-ball tutorial and it works fine. I changed a couple of materials to make it look better. I also added a C# script that should restart the level when the player falls off of the ground (I disables the walls). I am using Unity 5.5.
It initially looks like this:
But when I go off the edge and the level restarts, it looks like this:
It sometimes looks like this for a few seconds after opening unity when the editor is loading.
Here is the script:
using UnityEngine;
using System.Collections;
public class DeathTrigger : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter (Collider other)
{
if (other.gameObject.CompareTag("Player"))
Application.LoadLevel(Application.loadedLevel);
}
}
Any ideas on what's causing this?
The colors and materials are loaded. This is a lighting problem because lighliting is still calculating in the background. This will likely occur in the Editor only. This should not happen in the build.
Depending on your Unity version, you can fix this by going to Windows --> Lighting --> Settings then go to the Scene tab. Scroll down and disable Auto Generate checkbox then click the Generate Lightning button.
For older version of Unity with no Auto Generate checkbox, see here.
After play with Lighting tools, only one thing should be change on Lighting Setting for every scene.
Window > Rendering > Lighting (Unity 2020)
Click at Environment Tab
At Environment Lighting, change Source from Skybox to Color.
Select white color from Ambient Color.
Done. Try test it.
Before
After
I found many solutions online but I was missing out a step, so I hope this helps.
Most solutions indicated to go to Windows->Lightning, then untick Auto and Click Generate Lighting. My problem was that while I was pressing the generate button I did not have all of my scenes loaded for preview (at least not the scene I had problems with), so it was only applying light generation to the loaded scenes. Make sure all scenes are loaded when generating the lights.
Try Clearing Baked Data if you are using unity version around 5.5
Go to Windows->Lightning->Untick Auto->Now Click dropdown arrow of Build Button which is near Auto(Check Box) -> Select Clear Baked Data.
Now try Your code which looks fine although SceneManager.LoadScene (1); is enough.
Also unloading the previous scene and setting new scene as active scene is a good practice.
This worked for me.
File > Build settings > player Settings > (on the left) Graphics > (Top-Right) gear icon > Reset
I'm a newbie and none of the advice on web helped me. However when I went to Window > Rendering > Lightning > scene tab; If "lightning setting" says “none”, click on it and choose “demo”- setting. Press “generate”.
So it seems like it was missing settings all together which made the scene go dark when loaded.
I encountered the exact same problem. What worked for me was to set Directional Light > Light > Mode to Realtime. (it was Baked, for some reason)
I hope this can help someone in the future.

UI Automation Error: UI TESTING FAILURE-APP failed to quiesce within 30.0s

Since xCode updated i'm having trouble running any ui test case. It gives me this error when its expected to do a simple tapping action for example:
XCUIApplication *app = [[XCUIApplication alloc] init];
XCUIElement *passwordSecureTextField = app.secureTextFields[#"Password"];
[passwordSecureTextField tap];
Anyone have any ideas why am i getting this error? I've searched on google and here but haven't found any solutions.
Thank you.
Make sure you don't have any animations on screen during UI Automation tests. We had a text alert flashing on the login screen for debug/test builds of our app, and it would cause the "failed to quiesce" error until it was removed.
There are some other posts about this error that mention issues with UIRefreshControl, so I would suspect animating that or UIActivityIndicatorView would cause the same problem.
It might help to turn on the "All Exceptions" breakpoint. I used it and I recall getting the same error. It will break at the line with the problematic code and should show you the stack trace of the error with more info.
I had a similar error - as well as the simulator running very slowly. In my case it was fixed very simply by the method given in the accepted answer here: Xcode simulator extremely slow.
To save you a click: The issue was that I had accidentally pressed Cmd + T at some point, enabling "Slow animations".
I had to turn off the "Personal Hotspot" in order to get a working test environment (Because the blue bar in the top apparently disturbed XCTestRunner)
But as some tests need internet connection I can't do testing when being in the wild:-(
Anthony F's answer says it all. Likely something is still animating. The system seems to wait for the app UI to "settle" (go idle) and when that happens, it performs the tap action. However, when the UI constantly runs animations, it will never settle.
Xcode Console Output
Enable the console output in Xcode to see what happens when running the test.
Below is an example of the log, when it works well. The system waits for the app to go idle and when that has happened, it goes to find the button in the hierarchy.
t = 16.95s Tap "#go" Button
t = 16.95s Wait for app to idle
t = 17.00s Find the "#go" Button
t = 17.00s Snapshot accessibility hierarchy for XXX
t = 17.09s Find: Descendants matching type Button
t = 17.09s Find: Elements matching predicate '"#go" IN identifiers'
t = 17.10s Wait for app to idle
t = 17.15s Synthesize event
t = 17.41s Wait for app to idle
Below is an example when it fails. The system waits for the app to settle so that it can look for the button in the hierarchy. Since, it does not settle, it waits "forever" finally running into the timeout.
t = 18.88s Set device orientation to Unknown
t = 18.93s Tap "#go" Button
t = 18.93s Wait for app to idle
t = 79.00s Assertion Failure: UI Testing Failure - App failed to quiesce within 60s
In my case the "failed to quiesce" was caused, because at time t=18.90s, demo data was generated which caused repeated updates of a UIProgressView. From then on the app UI never settled ("quiesced").
("quiesce" as a word is not in my active vocabulary, which certainly has delayed my recognition of what was going on. The console output pushed me into the right direction. I'd bet "idle" rings more bells than "quiesce" for many developers.)

App works as desired in debug mode but crashes in Rally environment

I have created an app that creates a grid dynamically, as well as lets the user make changes to one of the grid columns via a 'numberfield' editor. Everything is working great in the debug environment but when I try to edit one of the fields in the Rally environment it crashes the app. From the looks of it, the iframe containing the app is just reloading altogether.
Now, here's the weird part that may be a clue to what's going on. The app crashes after I click elsewhere on the app (committing the change) but if I scroll the mouse wheel somewhere on the app, the spinner loses focus (no up/down arrows) and then if I click somewhere the edits are applied and the app doesn't crash. Once again in the debug mode I don't need to go through this, I can just click elsewhere and the changes are applied.
This is a known issue with 2.0p5 that will be fixed with the next release of the SDK. Basically it's using a sledgehammer to respond to the fact that something was edited and refreshing it. Since the new SDK can communicate with the message bus this is totally unnecessary...
In the meantime you should be able to patch your app by defining a global Rally.getApp function that returns your app instance to prevent the hard refresh:
//In your app definition give it an xtype:
Ext.define('My.App', {
extend: 'Rally.app.App',
//...
alias: 'widget.myapp'
//...
});
//Find the app instance by its xtype and return it
Rally.getApp = function() {
return Ext.ComponentQuery.query('myapp')[0];
};
You can then delete that code once 2.0p6 is released and you upgrade.

How to set a JavaFX Stage/Frame to Maximized

I'm using JavaFX 2. I want my frame to open maximized but I'm not seeing a way. I searched a bit on the internet without success. For the stage I see setFullScreen() and setIconified() but I don't see anything like setMaximized().
The Java 8 implementation of the Stage class provides a maximized property, which can be set as follows:
primaryStage.setMaximized(true);
When evaluating the sourcecode of the Ensemble.jar provided with the samples of JavaFX 2.0 SDK, the currently valid way to achieve window maximizing is
Screen screen = Screen.getPrimary();
Rectangle2D bounds = screen.getVisualBounds();
primaryStage.setX(bounds.getMinX());
primaryStage.setY(bounds.getMinY());
primaryStage.setWidth(bounds.getWidth());
primaryStage.setHeight(bounds.getHeight());
(you find similar code in WindowButtons.java)
The 'maximize' button is still enabled and when clicking it, the windows will grow a bit more (Windows OS). After this the 'maximize 'button is disabled. In the provided example the standard buttons are replaced. Maybe this is still an issue.
Better use Multi-Screen compatible maximize logic:
// Get current screen of the stage
ObservableList<Screen> screens = Screen.getScreensForRectangle(new Rectangle2D(stage.getX(), stage.getY(), stage.getWidth(), stage.getHeight()));
// Change stage properties
Rectangle2D bounds = screens.get(0).getVisualBounds();
stage.setX(bounds.getMinX());
stage.setY(bounds.getMinY());
stage.setWidth(bounds.getWidth());
stage.setHeight(bounds.getHeight());
try this simpler code
primaryStage.setMaximized(true);
and it fills up the whole screen
. note that if you remove maximize/minise buttons the application will fill the whole screen as well as remove the taskbar so mnd your initStyles if you have any
Use this to remove the Minimise, Maximise Buttons :
primaryStage.initStyle(StageStyle.UTILITY);
Where primaryStage is your Stage object.