Gil, all of the walls of my house are children under an empty game object. In a schematic, I want to change their Cast Shadow to false upon a key press. The thing is that I can't find a way to get all done in makinom. I am able to change them individually using the change field node, but that will take too long, considering I have hundreds of wall pieces. Is there a way to let makinom run through the child objects of the parent and look for their mesh renderers?
Post edited by Shadow_Fire on
  • Using selected data should allow doing that:
    - use a Select Components node to store all child objects with a mesh renderer as selected data
    - use a Change Fields node to change the property on all mesh renderers of the stored selected data
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
  • Do you think you can explain more on the change field node?
    After storing the components as selected data, I couldn't find the selected data option in the change field.
  • It's in the Object settings - select Selected Data as object, which allows you to define the Selected Key you used to store the components in.
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
  • Bingo! I totally missed that option.
    GiL, is there any way at all in makinom to tweak the Unity post process stack in game using either the game option dialogue or change field node?
  • Theoretically you should be able to change settings through function nodes (e.g. Change Fields node), but you might not be able to change everything you want.

    Another way would be to e.g. write some custom functions to change what you want and call them through Call Function nodes.
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
  • Thanks! I'll try those options and see what I came up with.
    GiL, you know how I used the change field node to change the cast shadow to false? It's working when I press play. Upon play, I just press a button and voila, all meshes will no longer show shadows. But when I build the game and tried to do it, nothing happen. Do you know why?
  • Hm - should work just the same in Unity and a built game.
    Might be some graphics/quality settings in Unity that are used in the built game?
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
  • edited May 31
    Hmm I'm also not sure why. But I also found another method with the shadowCastingMode. For testing purposes, I created a simple c# script that will disable the cast shadow of a game object.

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

    public class ShadowOff : MonoBehaviour {


    public GameObject obj;
    MeshRenderer meshRen;

    // Use this for initialization
    void Start () {

    meshRen = obj.GetComponent<MeshRenderer> ();

    }

    // Update is called once per frame
    void Update () {

    if(Input.GetKeyDown(KeyCode.L)){
    meshRen.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;

    }
    }
    }


    This works for both play and build mode. Except I couldn't get the change field node to work at all.

    On the change field node:

    Class name : MeshRenderer
    Field Name : shadowCastingMode
    Is Property : True
    Bool Value : False;

    Upon play, a message just pops up in the console
    Property change failed (UnityEngine.MeshRenderer): shadowCastingMode
    failed to convert parameters
    Do you know why? :)
    Post edited by Shadow_Fire on
  • Yes, because shadowCastingMode of the MeshRenderer is an enum value, not a bool.

    You'd need to set up an enum parameter:
    - Field Type: Enum
    - Enum Name: ShadowCastingMode
    - Int/Float Value: 0 (probably)
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
  • Ahh that's right! Thanks a lot.
Sign In or Register to comment.