How to set values for your custom properties in VFX Graph. Yeah, there are binders, but I find they expect a rather precise way of working.. Making your own scripts forces Unity to do what you actually want haha. In my VFX graph, I have a VECTOR 3 value named "realSpawnPos" which I'm using as the spawn position for some particles. It's important to note that "position", whilst it is a Vector3.. doesn't like receiving Vector 3 values. So make sure you set it up as a Vector 3 in the VFX graph. Further to this - Make sure in the VFX Graph, your position node is set to WORLD, if you need to set/get/whatever the world position and not local... your objects are probably nested in a million groups/transforms.. using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.VFX; public class bindPosition : MonoBehaviour { public GameObject target_thing; public VisualEffect visualEffect; void Update() {
I got a little fed up of dragging the (wrong) custom render texture swatches onto materials in the inspector (slightly down to my crap naming conventions & Unity's project window only showing the first 8 letters of each name- can this be changed?!), so I decided to figure out a C# script that could make this easier. The entire script is way below - I'm just going to highlight a few important lines. Shader shader = Shader.Find("custom/createdTextureShader"); This finds a shader that you've created externally. You could have a public shader variable at the top instead, so you could drop stuff into the Inspector. _init_mat = new Material(init_shader); Here we make a new material, using a specified shader type. _init_mat.SetTexture("_initTex", init_texture); Then we give it a texture file. _initTex is a property I've specified for the init_shader. Typically there is a _MainTex by default. I just wanted to see if you could specify arbitrary p
Comments
Post a Comment