User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active
 

Runtime Initialization

When initializing a decal at runtime, one has to do this in the Start() method, because of the decal system initializes itself in Awake() and OnEnable().

public DecalTextureAtlas atlas;
private EasyDecal decal;

public void Awake()
{
    decal = GetComponent<EasyDecal>();
}

public void Start() 
{ 
    decal.Atlas = atlas; 
    decal.AtlasRegionIndex = UnityEngine.Random.Range(0, 4);
}
 

 

 

 

 

 

Copyright © 2020 by Sycoforge Technologies. All Rights Reserved.