Posts

Showing posts from September, 2020

light type. LightType. light.type. ffs.

in the variables bit -  Light _yourlight; //define light variable   then maybe in the start() _yourlight = GetComponent<Light>(); //assign the light component to _yourlight variable if(_yourlight.type= LightType.Directional){ //check if the type is of LightType.Directional... Debug.Log("it's directional!"); } Reaaallly annoyed that this took ages to find... but hey, here's how you check the type of light you have, sort of.

changing material attributes at runtime

For some reason....Unity doesn't let me change Material attributes at run-time, with scripts... On selecting the offending Material in the Inspector it will suddenly update, but if left to it's own devices...nada. Apparently if you make a copy of the material and assign it to a disabled/hidden gameobject in the scene, then alter the material to be how you want it, on running the game your original material should function as desired. - this however didn't work for me :( But....it seems for what I was doing (altering the emission colour), simply setting the material's emission above 0 allowed the script to function properly. The internet suggested "shared materials" and "shader variants"...but I haven't had much luck with those either...

Animated FBX import

Animated FBX from Blender to Unity.. Process is the same for Maya, although the last time I did this it all worked?! I dunnoooooooooo. Import your animated FBX, make necessary adjustments to the import settings & bring it into the scene hierarchy. In the Project window somewhere, create a New Animation Controller, call it something. Select the root of your FBX, the very root -  not just the rig root - create an Animator component. Select the Animation Controller you made earlier. In the Animator tab, make a new state and select whichever animation clip you want.

rotating particle source shape in VFX graph

Image
 This is a bit rubbish, but it's how you rotate the source shape for particles in the vfx graph..