So I'm a total noob when it comes to scripts and using the call function node.
Can someone tell me how I get this script to activate on my enemy using Call Function? Basically what it's meant to do is apply the DeathMat material on my enemy gameobject and its children, wherever there is an input for a material. This will allow me to properly fade out my enemies. Also, let me know if I've done something wrong. This is a copy/paste from the Unity forums btw.
I also want to employ this technique to a petrify status if it's possible to do. i.e. change the materials to a stone texture. But, it will have to be able to be undone upon removal of the status effect.
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class DeathMaterial : MonoBehaviour {
void ChangeMaterialDeath(Material DeathMat) { Renderer[] children; children = GetComponentsInChildren<Renderer>(); foreach (Renderer rend in children) { var mats = new Material[rend.materials.Length]; for (var j = 0; j < rend.materials.Length; j++) { mats[j] = DeathMat; } rend.materials = mats; } } }
Unless you really want to rely on a script, you can also alter Materials and their properties using Makinom schematics/nodes.
Game Object > Renderer > Change Material lets you change materials on objects and child objects.
I think you wanted to have a shader do some sort of dissolve/petrify also, right?
You can set a Change Color node in Makinom to "fade" properties on a shader and get effects you want.
I'm actually setting one up right now an enemy death burn/dissolve. The dissolve shader has a _Progress property that the Makinom node fade works on. Initially the property is set at 1 on the material and this node brings it to 0 over 4 seconds, making the gameobject "burn out."
Note the "End Color" has to have an alpha of 0 in the color picker for it to work.
Well, ORK has fading as well, but the problem I have (as discussed earlier in this thread) is that the materials don't support alpha fading. When I set them to Fade or Transparent, they do not display properly, and that's why I have to change the material before I fade the object. I can certainly try using Makinom. I did have to delete it from my project earlier as it was giving me errors that were confusing me, though. So if that happens again I'll be asking even more questions.
The fading in this node doesn't actually affect alpha of the material when used in this way I think because I'm using it on a very simple diffuse shader with no actual alpha.
It's really just "fading" as in bringing the value from 1 to 0 of the _Progress property. I've tested it on other properties with ranges on other shaders too, such as the toon outline (to grow/shrink the outline) or a rim shader (to intensify the rim light.)
Btw, if you need a 2-pass shader for simulating petrifying gameobjects I can make one pretty quick and upload it later in the morning.
Looks like it's back to the Makinom based errors. I managed to create a schematic. Then I ran the game. When the schematic was to be called, Makinom crapped out. And I don't mean the schematic just failed to run, I mean the Makinom window became blank and inaccessible - even after reimporting the Makinom assets. And as long as I attempt to keep that window open, I receive these errors continuously:
So, um.... yeah
I think right now using a script would be preferable to whatever is going on with Makinom.
Will look at your project later today - as for the Makinom error, will check that out, a simple solution for now would be to close the Makinom editor before hitting play :)
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
The Makinom editor broke even while not playing. Once I tried to call the schematic, it broke it completely from then on. I had to delete it. I don't know what is going on >_<
I checked out your project - the issue is using End Immediately without Death Immediately, which currently leads to not using the last enemy's death. For the time being you can solve that by just enabling Death Immediately, will be changed in the next update.
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
In your battle system's settings (Battle System > Active Time Battles).
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
It may be that you get some errors due to unmapped inputs, as I'm using Unity inputs. If so, here is the InputManager.asset content:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!13 &1
InputManager:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Axes:
- serializedVersion: 3
m_Name: Horizontal
descriptiveName:
descriptiveNegativeName:
negativeButton: left
positiveButton: right
altNegativeButton: a
altPositiveButton: d
gravity: 3
dead: 0.001
sensitivity: 3
snap: 1
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Vertical
descriptiveName:
descriptiveNegativeName:
negativeButton: down
positiveButton: up
altNegativeButton: s
altPositiveButton: w
gravity: 3
dead: 0.001
sensitivity: 3
snap: 1
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire1
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left ctrl
altNegativeButton:
altPositiveButton: mouse 0
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire2
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left alt
altNegativeButton:
altPositiveButton: mouse 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire3
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left shift
altNegativeButton:
altPositiveButton: mouse 2
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Mouse X
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Mouse Y
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 1
joyNum: 0
- serializedVersion: 3
m_Name: Mouse ScrollWheel
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 2
joyNum: 0
- serializedVersion: 3
m_Name: Horizontal
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Vertical
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 1
type: 2
axis: 1
joyNum: 0
- serializedVersion: 3
m_Name: Fire1
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 0
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire2
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 1
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire3
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 2
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Jump
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 3
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Submit
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: return
altNegativeButton:
altPositiveButton: joystick button 0
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Submit
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: enter
altNegativeButton:
altPositiveButton: space
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Cancel
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: escape
altNegativeButton:
altPositiveButton: joystick button 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Interact/Accept
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: space
altNegativeButton:
altPositiveButton: enter
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Menu
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: escape
altNegativeButton:
altPositiveButton: q
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Walk
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left shift
altNegativeButton:
altPositiveButton: right shift
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Pause
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: p
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Tab
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: tab
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
Olive Branches ~ in development ~ now with a WEBSITE!!!
Olive Branches ~ in development ~ now with a WEBSITE!!!
So I'm a total noob when it comes to scripts and using the call function node.
Can someone tell me how I get this script to activate on my enemy using Call Function? Basically what it's meant to do is apply the DeathMat material on my enemy gameobject and its children, wherever there is an input for a material. This will allow me to properly fade out my enemies.
Also, let me know if I've done something wrong. This is a copy/paste from the Unity forums btw.
I also want to employ this technique to a petrify status if it's possible to do. i.e. change the materials to a stone texture. But, it will have to be able to be undone upon removal of the status effect.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DeathMaterial : MonoBehaviour {
void ChangeMaterialDeath(Material DeathMat)
{
Renderer[] children;
children = GetComponentsInChildren<Renderer>();
foreach (Renderer rend in children)
{
var mats = new Material[rend.materials.Length];
for (var j = 0; j < rend.materials.Length; j++)
{
mats[j] = DeathMat;
}
rend.materials = mats;
}
}
}
Olive Branches ~ in development ~ now with a WEBSITE!!!
Game Object > Renderer > Change Material lets you change materials on objects and child objects.
I think you wanted to have a shader do some sort of dissolve/petrify also, right?
You can set a Change Color node in Makinom to "fade" properties on a shader and get effects you want.
I'm actually setting one up right now an enemy death burn/dissolve. The dissolve shader has a _Progress property that the Makinom node fade works on. Initially the property is set at 1 on the material and this node brings it to 0 over 4 seconds, making the gameobject "burn out."
Note the "End Color" has to have an alpha of 0 in the color picker for it to work.
I can certainly try using Makinom. I did have to delete it from my project earlier as it was giving me errors that were confusing me, though. So if that happens again I'll be asking even more questions.
Olive Branches ~ in development ~ now with a WEBSITE!!!
It's really just "fading" as in bringing the value from 1 to 0 of the _Progress property. I've tested it on other properties with ranges on other shaders too, such as the toon outline (to grow/shrink the outline) or a rim shader (to intensify the rim light.)
Btw, if you need a 2-pass shader for simulating petrifying gameobjects I can make one pretty quick and upload it later in the morning.
Olive Branches ~ in development ~ now with a WEBSITE!!!
So, um.... yeah
I think right now using a script would be preferable to whatever is going on with Makinom.
Olive Branches ~ in development ~ now with a WEBSITE!!!
Olive Branches ~ in development ~ now with a WEBSITE!!!
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I don't know what is going on >_<
Olive Branches ~ in development ~ now with a WEBSITE!!!
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Olive Branches ~ in development ~ now with a WEBSITE!!!
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Olive Branches ~ in development ~ now with a WEBSITE!!!