unity – Why does Animator component prevent the player from facing left?

I’m making a 2D platformer with Unity. A few days ago, I was testing the game; the player could face right and left based on its moving direction and animations were playing correctly. I exited playmode because I had to assign the player position into a slot in inspector for the checkpoints. After assigning that, I entered the playmode again and surprisingly, I encountered a strange problem. The animations were working but the player was not able to face left when it was moving to the left side. I still have this problem. This is very strange to me because I didn’t change anything neither from the code nor the inspector. So I believe this is a random Unity bug. After testing the game many times, I found out these:

  1. If I disable Animator component, the player can flip again but obviously the animations won’t play.
  2. I can have both Animator and flipping working at the same time only when I check or uncheck root motion in playmode. But when I exit, the problem returns. So the previous unchecked or checked root motion will not work in the next playtest, so I can just check or uncheck it while the game is playing; otherwise it won’t work.

These are the reasons why I think the Animator component prevents the player from flipping but I have no idea why this is happening because this component has nothing to do with the facing code. Thanks in advance.

This is the code I use for flipping the protagonist:

bool isFacingLeft;

void Update()
    {
        //Move the player.
        //Target velocity is defined in another script and is not important in this context.
        targetVelocity = new Vector2(Input.GetAxis("Horizontal") * maxSpeed, 0);
       
       //Flip the player's localScale.x if the move speed is greater than .01 or less than -.01.
       if (isFacingLeft == true)
       {
          transform.localScale = new Vector2(Mathf.Abs(transform.localScale.x) * -1, transform.localScale.y);
       }
       else
       {
          transform.localScale = new Vector2(Mathf.Abs(transform.localScale.x), transform.localScale.y);
       }

       if (targetVelocity != Vector2.zero)
          isFacingLeft = targetVelocity.x < 0 ? true : false;
    }

How do I prevent WordPress from adding a "-1" suffix to some uploaded images?

Some images that I upload to the Media Library end up with a "-1" suffix added to the file name. For example camping.jpg is renamed by WP to camping-1.jpg

  • I am using WordPress 5.6.2
  • The affected images are not already present in the Library
  • This seems to affect images around 1500px wide; smaller images are not affected
  • No resizing occurs at any time
  • No image-affecting plugins installed (shortcodes-ultimate, classic-editor)
  • Using a child theme based on the Underboot theme

Any help would be greatly appreciated. Thanks!

dnd 5e – Does Mind whip prevent bonus actions if you take away an action?

The text for mind whip states

You psychically lash out at one creature you can see within range. The target must make an Intelligence saving throw. On a failed save, the target takes 3d6 psychic damage, and it can’t take a reaction until the end of its next turn. Moreover, on its next turn, it must choose whether it gets a move, an action, or a bonus action; it gets only one of the three. On a successful save, the target takes half as much damage and suffers none of the spell’s other effects

Meanwhile, the rules state

[…] anything that deprives you of your ability to take actions also prevents you from taking a bonus action.

If the target chooses a bonus action, it technically shouldn’t be able to do so, as it was deprived of its action. Or is this a case of specific beats general?

software update – What’s the best way to prevent my Mac from updating macOS?

I’d like to keep my Mac on Catalina forever. Other than disabling “Automatically keep my Mac up to date”, is there anything else I can do to prevent my Mac from upgrading to newer macOS versions? I’m still interested in receiving Catalina updates and Safari updates, but they don’t need to be automatic.

This machine will be kept online, but only used for audio software. It doesn’t need to be secure.

Prevent the (wifi) from turning off and Disable the (airmode) for Samsung tab A 2016 using adb or anything else

Prevent the wifi from turning off and Disable the airmode for Samsung tab A 2016 using adb or anything else.

  • I want if I touched the wifi bottom on the notification bar to say "security policy prevents turn off wifi"

  • and the same with airmode in the notification bar to say "security policy prevents of use airmode"

     **Android 8.1.1 (Galaxy Tab A (2016))**
    

macos – How to prevent the need to sign in to accounts on Mac

My Mac is connected to my Google (Gmail) and Microsoft (Outlook) accounts.
Every few days (once or twice a week) I have notifications that tell me to re-sign-in to these accounts;

  1. In most of the times, the System Preferences window pops up but no signing-in is actually needed, so I close it.
  2. In The other times in which signing-in is needed when the window pops up, all services work fine even when I dismiss it, so signing in is not actually necessary.

I would like to fix this:

  • To not have redundant notifications (§1).
  • To not have to sign in again and again to an account I already signed-in to (both §1 & §2).
  • Automatically dismissing/hiding/preventing the notifications themselves is also okay, as services are working anyway (see §2).

windows 10 – Prevent wifi from disconnecting on bad signal

My wifi connection is bad (on the border of the reachable area). It disconnects from time to time, but virtually always reconnects somewhere within 10 seconds (at a bad signal nevertheless).

Programs that use the internet connections disconnect when Windows shuts off its connection. Is there a way to increase the timeout length for wifi connections, or make it not disconnect even if the signal is VERY bad or unreachable for a period of time?

(A more general possible solution would also be: never disconnect from Wifi no matter the connection quality.)
(A possible solution would be: stay connected to a virtual adapter that forwards all connections from the actual Wifi adapter but remains working (queueing) when the Wifi connection gets disconnected for a period of time)

I haven’t found anything that seems to do this.

css – HTML: Prevent word-wrapping after some symbols or super-index

I need to avoid line breaks on special punctuators while html rules allow line breaks. I’m not worried about line breaking on whitespace, but on these cases:

a] Superscript “?”. Used in Spanish grammar to tell something is probably a-grammatical, or has a different meaning from expected:

”’Estoy en el ?candelabro.”’
will break on the ?

b] m-dash. In Spanish, m-dash is a parenthetical sign. It means it is spaced as quotes or parenthesis are: a pair of m-dashes around a text, with space outside and no space inside. Unicode breaking rules say, in their text form, that m-dash should be treated as non-breaking in these cases, but this rule stated in the textual description of line breaking rules is ignored in the actual algorithm.

So, how I can prevent line breaking on that situations? I have tried the “non-breaking zero space”, but it does not work.

8 – How to prevent image/file deletion from a configForm if don’t press on submit button?

I created a custom config Form in drupal 8, and this form have a managed_file field for upload a logo, the problem is that i set all fields, upload my image and fill other fields, press save, and in this point everything works normal. But if i press on “Delete” button of the image, my file is automatically deleted from my file directory and i have not saved the changes to my form yet.

so in my config still saved a fid of my deleted file. But the file was deleted before save my config form so if i update the page without save not matters, my file was deleted.

Any ideas for control this event to prevent this deletion if i don’t save the configuration Form?

my_module/src/Form/CustomForm.php

<?php

namespace Drupalmy_moduleForm;

use DrupalCoreFormConfigFormBase;
use DrupalCoreFormFormStateInterface;
use DrupalfileEntityFile;

/**
 * Class CustomizationForm.
 */
class CustomForm extends ConfigFormBase {

  /**
   * {@inheritdoc}
   */
  protected function getEditableConfigNames() {
    return (
      'my_module.custom',
    );
  }

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'custom_form';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $config = $this->config('my_module.custom');

    $form('menu_logo') = (
      '#type' => 'managed_file',
      '#title' => $this->t('Menu logo'),
      '#upload_validators' => (
        'file_validate_extensions' => ('png jpg jpeg'),
        'file_validate_size' => (25600000),
      ),
      '#theme' => 'image_widget',
      '#preview_image_style' => 'medium',
      '#upload_location' => 'public://',
      '#default_value' => $config->get('menu_logo'),
      '#required' => TRUE,
    );
    $form('splash_screen') = (
      '#type' => 'managed_file',
      '#title' => $this->t('Splash screen'),
      '#upload_validators' => (
        'file_validate_extensions' => ('png jpg jpeg'),
        'file_validate_size' => (25600000),
      ),
      '#theme' => 'image_widget',
      '#preview_image_style' => 'medium',
      '#upload_location' => 'public://',
      '#default_value' => $config->get('splash_screen'),
    );
    $form('theme') = (
      '#type' => 'select',
      '#title' => $this->t('Theme'),
      '#title_display' => 'invisible',
      '#options' => ('dark' => $this->t('Dark theme'), 'light' => $this->t('Light theme')),
      '#default_value' => $config->get('theme'),
    );

    $form('#attached')('library') = (
      'my_module/customization_form',
    );

    $buildForm = parent::buildForm($form, $form_state);
    $buildForm('#theme') = 'customization_form';

    return $buildForm;

  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    parent::submitForm($form, $form_state);

    $this->config('my_module.custom')
      ->set('menu_logo', $form_state->getValue('menu_logo'))
      ->set('splash_screen', $form_state->getValue('splash_screen'))
      ->set('theme', $form_state->getValue('theme'))
      ->save();

    if (!empty($images)) {
      foreach ($images as $image) {
        $file = File::load($image(0));
        $file_usage = Drupal::service('file.usage');
        $file->setPermanent();
        $file->save();

        $file_usage->add($file, 'my_module', 'file', $file->id());
      }
    }

  }

}

architecture – How to prevent component from re-rendering? (with MWE)

How can I prevent a component from re-rendering when its props are not changed?

Code sandbox link/minimal working example. Move your cursor over Canvas and see that the console is logged with many "Canvas re-rendered" messages.

At the top-level, I pass in a const function as a handler to the Canvas. The onMouseMoveHandler updates App‘s state so that it can update the Details component:

<div className="App">
  <Canvas onMouseMoveHandler={onMouseMoveHandler} />
  <Details passedProp={getValue} />
</div>

I need it so that Canvas is not re-rendered because the HTML canvas element inside has user-drawn lines. How can I do this?

I would have thought that using React.memo would make it like a pure component so that it is not re-rendered.

I am a very beginner to React and if I am not thinking of the right code structure, let me know how to fix.