shaders – Interactive texture modification (such as fluid mixing) in Unity

I am working on a game where I want to allow users to mix multiple colors (similar to shown in this video): https://youtu.be/11UFYyv8hjs?t=316.

I have the following questions:

  1. I am expecting that this is done using shaders. What kind of shader I have to use for such implementation? What will be the logic to create this type of shader?

  2. Are there any other ways using which this feature can be implemented?

  3. Are there any open source tutorials or examples?

I would appreciate any suggestions and thoughts on this topic. Thank you.

unity3d – Problem importing Vector shapes in .psb to Unity?

My .PSB file in photoshop has my character that is made up of vector shapes.I haven’t rasterized it. When I import that .psb file to Unity , nothing shows. But if I rasterize it , it works. I want to use vector shapes without rasterizing so that I can make changes to it easily later on. Is there any way to do it ? or Am I just heading into wrong direction ?

unity – How Does Keto Premiere (Weight Loss) Really Work Safe & Use?

Keto Premiere is an inebriated ketogenic diet along these lines; it decreases fat much effectively and snappy. From an overall perspective, in ketosis, you change your body into a fat gobbling up machine. The Keto Premiere Diet Formula may help keep you in ketosis longer, so you exhaust all around MORE fat. Keto Premiere contain beta-hydroxybutyrate (BHB) which is principally lead the whole body to begin consuming fat as vitality as an option to sugars. Keto Premiere enhancements are defensive approach to get in shape with no symptom. These enhancements will expend your excess and bothersome fats including step by step fats to make vitality. It will craving lower to help the weight decrease, and keep your extraordinary body prosperity by keeping your body and brain dynamic for the duration of the day. Click here to order Keto Premiere: https://www.streetinsider.com/FMR+Wire/Keto+Premiere+Reviews+%26+Pills+Price+for+Sale-+Updated+2020/17340253.html

unity and maya – how to export/import fbx animation with rootmotion and non-rootmotion clips?

I’ve started learning about and playing around with animations in Unity and I’ve installed the Basic Motions Pack by Kevin Iglesias. I wanted to know how they work and to see if I can modify them so I’ve looked at the animation files which are .fbx. The animation hierarchy in Unity looks like this

animation hierarchy

where BasicMotions@Walk01 is the in-place animation and (RootMotion) is the root motion variant which has velocity. I’ve looked into what root motions are and I think I’ve grasped what they are, but here’s where things have gotten interesting.

I’ve imported the BasicMotions@Walk01.fbx into Maya and it looks like this

Maya hierarchy

it has a root joint for root motion and the animation moves the rig in each keyframe. So far so good! I’ve modified the animation so that it plays in reverse, basically made a sketchy reverse walk animation. Exported it to .fbx with the following parameters

Export props

And then opened that in Unity, however when I import the animation and rig it it only has one clip and it’s the Root motion clip, and I can’t get the non-rootmotion clip.
The Root Transform Position (XZ) Loop match is always red and if I don’t bake it into pose the animation functions like the Kevin’s RootMotion animations, but I don’t know how to get the non-RootMotion clip. What am I doing wrong here?

unity – GraphicRaycaster on the child object containing buttons blocks Raycast from the parent object containing GraphicRaycaster. How to solve it?

What I’m trying to achieve is to detect clicks on buttons in UI. Here is the tree:
I have a parent object SlotMachineScreen containing GraphicRaycaster with a script detecting clicks attached to it:

if (Input.anyKeyDown)
        {
            //Set up the new Pointer Event
            m_PointerEventData = new PointerEventData(null);
            //Set the Pointer Event Position to that of the mouse position
            m_PointerEventData.position = Input.mousePosition;

            //Create a list of Raycast Results
            List<RaycastResult> results = new List<RaycastResult>();

            //Raycast using the Graphics Raycaster and mouse click position
            m_Raycaster.Raycast(m_PointerEventData, results);
            foreach (RaycastResult result in results)
            {
                Debug.LogWarning("Hit " + result.gameObject.name);
            }
        }

And there are a bunch of child objects with a GraphicRaycaster (red ones) with buttons in it, that I want to detect a click on. But there is no response from my sprit at all when I click on them.

I found one solution so far, but its not what I need: the solution is to move all buttons from child containers to SlotMachineScreen.
Are there any different ways to solve this problem?

Tree

unity – How can I get a List of the code that the player is typing in the game?

This script is attached to 10 cubes that act like buttons :

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using UnityEngine;

public class SecurityKeypadKeys : MonoBehaviour
{
    public TextMesh text;

    private static int counter = 0;

    private void Start()
    {
       
    }

    private void OnMouseDown()
    {
        if(counter >= 8 && text.text == "")
        {
            counter = 0;
        }

        string() digits = Regex.Split(transform.name, @"D+");
        foreach (string value in digits)
        {
            int number;
            if (int.TryParse(value, out number))
            {
                if (counter < 8)
                {
                    text.text += number.ToString();
                    Number(number);

                    counter++;
                }
            }
        }
    }

    public int Number(int number)
    {
        return number;
    }
}

For example the player pressed on button number 1 then it will return 1 in the Number method then the player press on 1 again and then on 5 and then on 8 so the code should be : 1158 I want to get that code in another script in a List but not sure what to do in the Update :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SecurityKeypadSystem : MonoBehaviour
{
    public GameObject() keyPadNumbers;
    public List<int> code = new List<int>();

    private bool getCode = true;

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if (keyPadNumbers.Length == 0)
        {
            keyPadNumbers = GameObject.FindGameObjectsWithTag("Keypad");
        }
        else
        {
            if (getCode == true)
            {
                if (keyPadNumbers.Length == 0 && code.Count > 0)
                {
                    code = new List<int>();
                }
                foreach (GameObject go in keyPadNumbers)
                {
                    int number = go.GetComponent<SecurityKeypadKeys>().Number();
                    code.Add(number);
                }

                getCode = false;

                if (code.Count == 0)
                {
                    getCode = true;
                }
            }
        }
    }
}

The idea is to get a collection of all the pressed numbers as a code in the second script so it will be easier later to use the code as one number like : 1158 or 7854 or any numbers the player pressed. So later in the second script I will have a code that I will be able to use in another scripts for comparing or for making things happens like in this script :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;

public class UnlockCrate : MonoBehaviour
{
    public int code;
    public GameObject player;
    public Animation anim;
    public IKControl ikControl;
    public InteractableItem interactableItem;
    public GameObject securityKeyPad;
    public GameObject securityKeyPadText;
    public CinemachineVirtualCamera virtualCam;
    public CinemachineFreeLook freeLookCam;
    public CamerasControl camerasContorl;

    private bool playAnimOnce = false;
    private TextMesh text;

    private void Start()
    {
        text = securityKeyPadText.GetComponent<TextMesh>();
    }

    private void Update()
    {
        var distance = Vector3.Distance(player.transform.position, transform.position);
        
        if (distance <= interactableItem.distance)
        {
            if (!playAnimOnce)
            {
                if(ikControl.handFinishedMove == true)
                {
                    securityKeyPad.SetActive(true);
                    virtualCam.enabled = true;
                    freeLookCam.enabled = false;
                    Cursor.visible = true;
                    camerasContorl.enabled = false;

                    /*if(securityKeyPad.GetComponent<SecurityKeypadKeys>().UnlockedCode() == true)
                    {
                        securityKeyPad.SetActive(false);
                        virtualCam.enabled = false;
                        freeLookCam.enabled = true;
                        Cursor.visible = false;
                        anim.Play("Crate_Open");
                    }*/


                    //anim.Play("Crate_Open");
                    playAnimOnce = true;
                }               
            }
        }
        else if (playAnimOnce)
        {
            text.text = "";
            securityKeyPad.SetActive(false);
            virtualCam.enabled = false;
            freeLookCam.enabled = true;
            Cursor.visible = false;
            camerasContorl.enabled = true;
            anim.Play("Crate_Close");
            playAnimOnce = false;
        }
    }
}

Something like this or this idea :

if(securityKeyPad.GetComponent<SecurityKeypadKeys>().UnlockedCode() == true)

So if the code that the player typed is equal to the code in the UnlockCrate script then play the animation that open the carte :

anim.Play("Crate_Open");

unity – What is the equivalent for “(Input.GetAxisRaw(Horizontal))” in the new Input System?

I’m making a 2D platformer game with Unity and I have some problems with the new Input System. Also, I’m using PlayerInput component with invoke unity events behavior. In fact, I downloaded a player controller code from GitHub to use it as a guide so I used it in my actual player controller. But there is a problem and that is the code is using the old Input and I don’t know how to change “Input.GetAxis” and what is the equivalent in the new system. I’ve read many documents about it and I know that there is no official equivalent but there should be a way to get the same output. And other than this you may find some mistakes in the code and I would appreciate If you guide me. Thanks in advance.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
    private PlayerInputActions controls;

    private Rigidbody2D rb;
    private Animator anim;
    private bool facingRight = true;
    private float moveInput;
    public Transform feetPos;
    public float jumpInput;
    public float speed;

    (SerializeField) float JumpVelocity = 5;
    float JumpPressedRemember = 0;
    (SerializeField) float JumpPressedRememberTime = 0.2f;

    float GroundedRemember = 0;

    (SerializeField) float GroundedRememberTime = 0.25f;
    (SerializeField) float HorizontalAcceleration = 1;
    (SerializeField) (Range(0, 1)) float HorizontalDampingBasic = 0.5f;
    (SerializeField) (Range(0, 1)) float HorizontalDampingWhenStopping = 0.5f;
    (SerializeField) (Range(0, 1)) float HorizontalDampingWhenTurning = 0.5f;
    (SerializeField) (Range(0, 1)) float JumpHeight = 0.5f;

    private void Awake()
    {
        controls = new PlayerInputActions();
    }

    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        anim = GetComponent<Animator>();
    }

    public void OnMove(InputAction.CallbackContext context)
    {
        moveInput = context.ReadValue<float>();
    }

    public void OnJump(InputAction.CallbackContext context)
    {
        JumpVelocity = context.ReadValue<float>();
    }

    void FixedUpdate()
    {
        rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);
      
        if (facingRight == false && moveInput > 0)
        {
            Flip();
        }
        else if (facingRight == true && moveInput < 0)
        {

            Flip();
        }
    }

    void Flip()
    {
        facingRight = !facingRight;
        Vector3 Scaler = transform.localScale;
        Scaler.x *= -1;
        transform.localScale = Scaler;
    }

    void Update()
    {
        Vector2 GroundedBoxCheckPosition = (Vector2)transform.position + new Vector2(0, -0.01f);
        Vector2 GroundedBoxCheckScale = (Vector2)transform.localScale + new Vector2(-0.02f, 0);
        bool Grounded = Physics2D.OverlapBox(GroundedBoxCheckPosition, transform.localScale, 0);

        GroundedRemember -= Time.deltaTime;

        if (Grounded)
        {
            GroundedRemember = GroundedRememberTime;
        }

        JumpPressedRemember -= Time.deltaTime;

        if (controls.Player.Jump.triggered)
        {
            JumpPressedRemember = JumpPressedRememberTime;
        }

        if (controls.Player.Jump.triggered)
        {
            if (rb.velocity.y > 0)
            {
                rb.velocity = new Vector2(rb.velocity.x, rb.velocity.y * JumpHeight);
            }
        }

        if ((JumpPressedRemember > 0) && (GroundedRemember > 0))
        {
            JumpPressedRemember = 0;
            GroundedRemember = 0;
            rb.velocity = new Vector2(rb.velocity.x, JumpVelocity);
        }

        float HorizontalVelocity = rb.velocity.x;
        HorizontalVelocity += Input.GetAxisRaw("Horizontal");

        if (Mathf.Abs(Input.GetAxisRaw("Horizontal")) < 0.01f)
            HorizontalVelocity *= Mathf.Pow(1f - HorizontalDampingWhenStopping, Time.deltaTime * 10f);
        else if (Mathf.Sign(Input.GetAxisRaw("Horizontal")) != Mathf.Sign(HorizontalVelocity))
            HorizontalVelocity *= Mathf.Pow(1f - HorizontalDampingWhenTurning, Time.deltaTime * 10f);
        else
            HorizontalVelocity *= Mathf.Pow(1f - HorizontalDampingBasic, Time.deltaTime * 10f);

        rb.velocity = new Vector2(HorizontalVelocity, rb.velocity.y);
    }
}

unity – How to access and change a Tilemap’s Order in Layer?

I’m making a game about two ghosts, and an important thing that I want to add is the possibility to pass through walls. I have managed to make the passable behaviour and everything.

Next, I need to change the Tilemap’s Order in Layer number. That’s because I want to add some things inside the Tilemap that should be shown until player passes the wall. The way I though of to do this is to decrease the tilemap’s layer order when the player is inside it, and put it back to the previous value when player exits.

unity – How to fix lag in 64 bit Android devices

My game’s FPS drops to 30 – 8 FPS on any 64 bit Android device but is at 59 – 60 FPS on an even lesser 32 bit Android device.

I’ve tried unchecking Development Build on Build settings and I’ve tried disabling debug calls on my game by using:

void Update ()
{
#if UNITY_EDITOR
if(!Debug.unityLogger.logEnabled)
    Debug.unityLogger.logEnabled = true;
#else
if(Debug.unityLogger.logEnabled)
    Debug.unityLogger.logEnabled = false;
#endif
}

But there wasn’t any change. And I tried setting all Stack Trace Log type to None(Edit > Project Settings > Player). Also no change.

PS: I used that update call because there are other imported assets that call the Debug class and I wouldn’t want to mess around with their classes.

unity – How can I make the flag to be true and false but each time only once?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;

public class UnlockCrate : MonoBehaviour
{
    public Animation anim;
    public IKControl ikControl;
    public GameObject securityKeyPad;
    public CinemachineVirtualCamera virtualCam;
    public CinemachineFreeLook freeLookCam;
    public CamerasControl camerasContorl;

    private bool playAnimOnce = false;

    private void Update()
    {

        if (!playAnimOnce)
        {
            if (ikControl.handFinishedMove == true)
            {
                securityKeyPad.SetActive(true);
                virtualCam.enabled = true;
                freeLookCam.enabled = false;
                Cursor.visible = true;
                camerasContorl.enabled = false;                
            }

            playAnimOnce = true;
        }
        else if (playAnimOnce)
        {
            securityKeyPad.SetActive(false);
            virtualCam.enabled = false;
            freeLookCam.enabled = true;
            Cursor.visible = false;
            camerasContorl.enabled = true;
            playAnimOnce = false;
        }
    }
}

The problem is that the playAnimOnce flag is false then true then false then true all the time.
I want that if it’s false do something and then only if it’s true do something else.0

Should I use another flag helper and how ?