unity – Setting a texture’s “Max Size” while ensuring that its dimensions are still multiples of 4

A version of my game has several large textures with dimensions that are multiples of 4 so that Crunch compression can kick in.

A ported version of my game, for platforms that have very limited RAM restrictions, will need us to limit the “Max Size” of our textures to 512 or 256, etc.

There are some cases in which a Crunch-friendly texture, when resized by Unity’s “Max Size” parameter, will actually end up with dimensions that aren’t multiples of 4.

944x800 would end up as 512x434, if we select “512”, which isn’t good for Crunch.

The naive solution in my mind is to write a simple script/tool that resizes/pads all my textures by a couple of pixels in such a way that Unity’s resize will end up in a Crunch friendly way. However, I’d rather do that as a last recourse if possible.

Is there a more standard way to approach this situation of mine?

magento2 – On setting New Magento 2.4.2 Version Front-end is messy

You can use these commands to thoroughly upgrade compile and deploy your code.

Upgrade

php bin/magento setup:upgrade

Compile

php bin/magento setup:di:compile

Deploy

php bin/magento setup:static-content:deploy -f

Cache Clear

php bin/magento cache:clean or cache:flush

Grant Permission

chmod 777 -R var/* pub/* generated/*

You can run a combined command for everything.

sudo php bin/magento setup:upgrade && 
sudo php bin/magento setup:di:compile && 
sudo php bin/magento setup:static-content:deploy -f && 
sudo chown 777 -R var/* pub/* generated/* && 
sudo php bin/magento c:f && 
sudo chown -R $USER:www-data ../mag24/

unity – I used bool parameter in my animator controller setting it to true by script but where should I set it back to false and when?

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class FireEffect : MonoBehaviour
{
    public Transform player;
    public Transform target;

    private float timeElapsed = 0;
    private float lerpDuration = 3;
    private float startValue = 1;
    private float endValue = 0;
    private float valueToLerp = 0;

    private Animator playerAnimator;
    private bool prevFacing = false;
    private bool stopped = false;
    private bool move = true;
    private bool rot = false;
    private Vector3 currPos;

    private void Start()
    {
        playerAnimator = player.GetComponent<Animator>();
    }

    private void Update()
    {
        var currFacing = IsFacing(target);
        if (currFacing != prevFacing)
        {
            timeElapsed = 0;
        }
        prevFacing = currFacing;

        var distance = Vector3.Distance(player.position, target.position);

        if (IsFacing(target))
        {
            if (distance < 10 && move)
            {
                if (timeElapsed < lerpDuration)
                {
                    valueToLerp = Mathf.Lerp(startValue, endValue, timeElapsed / lerpDuration);
                    playerAnimator.SetFloat("Forward", valueToLerp);
                    timeElapsed += Time.deltaTime;
                }
                playerAnimator.SetFloat("Forward", valueToLerp);
                stopped = true;
                valueToLerp = 0;
            }

            if (move == false)
            {
                playerAnimator.SetFloat("Forward", 0);
            }

            if (playerAnimator.GetFloat("Forward") == 0 && stopped)
            {
                move = false;
                rot = true;
                currPos = player.position;
                stopped = false;
                Debug.Log("Player current position when valueToLerp value is 0 : " + currPos);
            }
        }
        
        if(rot)
        {
            playerAnimator.SetBool("Walk Back", true);

            rot = false;
        }

        if (playerAnimator.GetCurrentAnimatorStateInfo(0).IsName("Walk Back"))
        {
            playerAnimator.SetBool("Walk Back", false);
        }
    }

    private bool IsFacing(Transform target)
    {
        Vector3 forward = player.TransformDirection(Vector3.forward);
        Vector3 toTarget = target.position - player.position;
        return Vector3.Dot(forward, toTarget) > 0;
    }

    public IEnumerator ScaleOverSeconds(Vector3 scaleTo, Vector3 rotateTo, Vector3 moveTo, float seconds)
    {
        float elapsedTime = 0;
        Vector3 startingScale = player.localScale;
        Vector3 startingRotation = player.localEulerAngles;
        Vector3 startingPosition = player.localPosition;

        while (elapsedTime < seconds)
        {
            player.localScale = Vector3.Lerp(startingScale, scaleTo, (elapsedTime / seconds));
            player.localEulerAngles = Vector3.Lerp(startingRotation, rotateTo, (elapsedTime / seconds));
            player.localPosition = Vector3.Lerp(startingPosition, moveTo, (elapsedTime / seconds));

            elapsedTime += Time.deltaTime;

            yield return null;
        }
        player.localScale = scaleTo;
        player.localEulerAngles = rotateTo;
        player.localPosition = moveTo;
    }
}

At this part, I’m setting the bool to true once and it’s playing the “Walk Back”.

if(rot)
            {
                playerAnimator.SetBool("Walk Back", true);
    
                rot = false;
            }
    
            if (playerAnimator.GetCurrentAnimatorStateInfo(0).IsName("Walk Back"))
            {
                playerAnimator.SetBool("Walk Back", false);
            }

After that, I’m setting the trigger to false when it’s finishing playing it because if I will not set it to false it will keep playing the “Walk Back” nonstop.

I want that it will play it once but also when rot is true again then play it again once.
but because I’m setting it false it’s not playing it again even if rot is true again.

animator controller

I created a transition from the Grounded blend tree to the Walk Back with the bool condition in the screenshot.

The Walk Back is working fine smooth as I wanted the problem is now how to make it play once only each time rot is true?

The way or the place in the script I’m setting the bool back to false make it that it will not play the Move Back ever again even if rot is true.

9 – Setting visibility by content type while adding block to region from code

I created block from code. Now I want to add it to specific region (‘sidebar_first’) also from code. I’m doing it like this:

function event_block_preprocess_page(&$vars)
{
    if (DrupalblockEntityBlock::load('event_block_1') == null){
        $values = array(
            // A unique ID for the block instance.
            'id' => 'event_block_1',
            // The plugin block id as defined in the class.
            'plugin' => 'event_block',
            // The machine name of the theme region.
            'region' => 'sidebar_first',
            'settings' => array(
                'label' => 'Event block',
            ),
            // The machine name of the theme.
            'theme' => 'bartik',
            'visibility' => array()
            ),
            'weight' => 100,
        );
        $block = DrupalblockEntityBlock::create($values);
        $block->save();
    }
}

This works, but problem is that block is displayed on every page. What I want is to display that block only on pages in content type “event”.

When configuring block from back-end there is “visibility” section and inside it there is a tab allowing setting block to be visible only on specific content types. I want to achieve the same from code. I expect that additional parameters should be passed to “visibility” array and I tried something like:

    'visibility' => array(
        'node_type' => array(
            'event'
        )
    ),

or

        'visibility' => array(
            'content_type' => array(
                'event'
            )
        ),

but nothing of those works. How can I set visibility by content type?

lenovo – Advice on setting up cross compilation tool chain for Android 10 SDK29+?

I have a simple ‘helloworld.c” that I want to run from ADB shell then eventually create an app that can display it on my device.
Im quite new to C, Linux, Android, cross compiling, libraries in terms of real world results but Iv been doing a hell of a lot of reading and am getting used to my Linux (full install). I realise following various tutorials can be misleading due to the fact of outdated software / differnet hardware as I am attempting the above challenge on a relatively new device with relatively new hardware “android 10 R”. I could just do with some ‘best practice’ advice on choosing the correct libraries and tool chain setup.

I understand making the ‘helloworld’ as an app is more complicated requiring use of Android NDK, so first step is to get it working within ADB shell.

Device – Lenovo M8 FHD android 10 R

aarch64

armv8l ( returned from ADBShell> uname -m )

SDK29

Installed libraries –

ii g++ 4:9.3.0-1ubuntu2 amd64 GNU C++ compiler

ii g++-9 9.3.0-17ubuntu1~20.04 amd64 GNU C++ compiler

ii gcc 4:9.3.0-1ubuntu2 amd64 GNU C compiler
ii gcc-9 9.3.0-17ubuntu1~20.04 amd64 GNU C compiler

ii gcc-9-aarch64-linux-gnu 9.3.0-17ubuntu1~20.04cross2 amd64 GNU C compiler (cross compiler for arm64 architecture)

ii gcc-9-arm-linux-gnueabi 9.3.0-17ubuntu1~20.04cross2 amd64 GNU C compiler (cross compiler for armel architecture)

ii gcc-aarch64-linux-gnu 4:9.3.0-1ubuntu2 amd64 GNU C compiler for the arm64 architecture

ii gcc-arm-linux-gnueabi 4:9.3.0-1ubuntu2 amd64 GNU C compiler for the armel architecture

ii libllvm10:amd64 1:10.0.0-4ubuntu1 amd64 Modular compiler and toolchain technologies, runtime library

ii libllvm11:amd64 1:11.0.0-2~ubuntu20.04.1 amd64 Modular compiler and toolchain technologies, runtime library

ii libllvm11:i386 1:11.0.0-2~ubuntu20.04.1 i386 Modular compiler and toolchain technologies, runtime library

ii libxkbcommon0:amd64 0.10.0-1 amd64 library interface to the XKB compiler – shared library

ii libxkbcommon0:i386 0.10.0-1 i386 library interface to the XKB compiler – shared library

Firstly is the aarch64 above the correct cross compiler for my device?
Any clarification on how to make sure I have JUST the tools I need for getting helloworld in shell including relevent versions that work with SDK29 ?

So far when I try to run my cross compiler helloworld.c from shell I get – file not found error.
I have googled for many answers on this error and believe its a compilation error, so now Im just lost in libraries! and what did I do wrong. I think the tutorial I used has mislead me to wrong cross compiler choice, I don’t know?

ps I will try and clean this question up.
also I understand LLVM could help my problem but is this still experimental ?

Setting precision of a result for the next calculation

Sorry for my easy question.

I would like to learn how I could change the precision of a value to use it for the next calculation ?

Lets say, a=9.96329×10^-13, in fact this value is so small and can be taken as zero. However, I don’t know how to impose Mathematica to take it zero by setting its precision.

I need to multiply the value of a with the b value which is equal to 10^15 and if I can’t arrange the precision of the a,the multiplication will give the result of 10^12 which in reality I want it to be zero.

Could you help me about this issue ?

Best Regards,

plist – Setting a Chrome policy on Mac

Trying to set some policies for Chrome Beta, to disable uninstalling some extensions and incognito.

But editing ~/Library/Preferences/com.google.Chrome.beta.plist seems to have no effect.

$ defaults read com.google.Chrome.beta.plist
{
    ExtensionInstallForcelist =     (
        "eookhngofldnbnidjlbkeecljkfpmfpg;https://clients2.google.com/service/update2/crx",
    );
    HomepageLocation = "https://www.google.com";
    IncognitoModeAvailability = 1;
    LastRunAppBundlePath = "/Applications/Google Chrome Beta.app";
}

What am I missing? Do policy keys go somewhere else?

local customs – In winter, do Norwegians typically change shoes at the door in a business setting?

I’m visiting Norway on business next week. Our partner company is an engineering firm (metal fabrication, etc) in the northern part of the country. I expect to spend most of the trip in ordinary meeting rooms, though it seems likely that we might tour their production facilities at some point.

It’s a mundane question, but I’m wondering which boots to bring (safety boots will certainly be mandatory in production areas). I have some big clumpy orange calf-high boots which will be good in snow and the workshop, but a bit industrial for sitting around the boardroom table. And a more discreet black lace-up pair that would be acceptable for either.

If I’ll be wearing boots indoors and out, I’ll take the black ones. But getting them on and off at the door is a chore because of the long laces. So if I’m expected to do that, the orange boots (which slip easily on and off) are much more practical, and better anyway for the outside parts. I have a pair of light slip-on indoor shoes I normally bring for work-boots-stay-outside locations. I just don’t know whether Norway falls into that category. Any Norwegians able to comment?

windows – Windows10 GPO proxy setting applied without values

I’m trying to set up proxy via AD GPO. I followed this guide and configured the IE10 setting in user preferences (screen in Italian):

gpo screenshot

When I log into an account for which the policy applies I see the proxy as enabled but the proxy host field is empty! If I disable the proxy option and run gpupdate /force┬áit will be enabled again, so it seems the policy is received… But why only partially?

windows setting when gpo applied

Client is Win10 Pro 19041.28.

Thanks