Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity custom update

float StartingRate = 0.5f;
float UpdateRate = 0.3f;

void Start(){
	InvokeRepeating("CustomUpdate",StartRate, UpdateRate);
    //This will start in 0.5s and start repeating in 0.3f 
}
void CustomUpdate(){
	//Your code here
}
Comment

unity custom update


using UnityEngine;
 using System.Collections;

 public class DamageSource : MonoBehaviour {
     protected float damageAmount = 10f;

     //not 100% necessary, but handy for an example of how to 
     //handle damage based on the attacker (which is 
     //relevant for info sent in the OnTakeDamage() method
     protected ElementType elementType = ElementType.Normal;

     //we use a function for getting the damage this 
     //DamageSource can do because it lets us overwrite it.
     //Eg, if the enemy is weakened, you can factor that 
     //in and return a lesser amount of damage.
     public float GetDamageAmount() {
         return damageAmount;
     }

     public ElementType GetElementType() {
         return elementType;
     }
 }

 //kinds of elements available for damage / resistance calculations
 public enum ElementType {
     Normal,
     Fire,
     Ice,
     Lightning
 }

Comment

PREVIOUS NEXT
Code Example
Csharp :: discord bot status code c# 
Csharp :: fill all array c# with same value 
Csharp :: read xml file c# 
Csharp :: photon rpc 
Csharp :: unity how get random color to material 
Csharp :: how to get key value from json object in c# 
Csharp :: is keyboard clicked in Unity 
Csharp :: c# send email 
Csharp :: c# compile just one exe 
Csharp :: replace double backslash with single backslash c# 
Csharp :: how to pause code execution in c# 
Csharp :: unity point between two positions 
Csharp :: int to ascii c# 
Csharp :: c# inline if 
Csharp :: unity default cube mesh 
Csharp :: c# get offset from timezone 
Csharp :: c# create array 
Csharp :: key value pair in c# 
Csharp :: how unsort the data table options 
Csharp :: C# get key by value Dict 
Csharp :: how to clone something unity 
Csharp :: c# find element by condition 
Csharp :: c# read file line by line 
Csharp :: .net c# print object 
Csharp :: yanderedev 
Csharp :: total months between two dates c# 
Csharp :: convert list to ienumerable 
Csharp :: c# convert int to string 
Csharp :: get out of foreach statement c# 
Csharp :: function on animation end unity 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =