Simple Plant GrowthSimple Plant Growth
Simple Plant GrowthSimple Plant Growth
  • Docs
  • API
  • Changelog
  • Unity Asset Store
  • Bug report
  • Getting Started
  • How to add grass
  • How to add a tree
  • How to update grass
  • How to update a tree
  • How to grow grass manually
  • How to grow a tree manually
Generated by DocFX
(with DiscordFX + SingulinkFX)

Search Results for

    How to grow grass manually

    (Each patch of grass is considered as an instance)

    Global

    Growing all the grass

    Asynchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private GrassComponent _grassComponent;
    
        public async Task GrowGrassAsync()
        {
            await _grassComponent.GrowAllAsync();
        }
    }
    

    Synchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private GrassComponent _grassComponent;
    
        public void GrowGrass()
        {
            _grassComponent.GrowAll();
        }
    }
    

    Growing a patch of grass at a given position

    Asynchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private GrassComponent _grassComponent;
    
        public async Task GrowGrassAsync(Vector3 globalPosition)
        {
            Vector2Int positionInstance = _grassComponent.GetNearestInstance(globalPosition);
    
            await _grassComponent.GrowFromInstancesAsync(positionInstance);
        }
    }
    

    Synchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private GrassComponent _grassComponent;
    
        public void GrowGrass(Vector3 globalPosition)
        {
            Vector2Int positionInstance = _grassComponent.GetNearestInstance(globalPosition);
    
            _grassComponent.GrowFromInstances(positionInstance);
        }
    }
    

    With a grass asset

    Growing all the grass related to a specific grass asset

    Asynchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private GrassComponent _grassComponent;
    
        public async Task GrowGrassAsync(GrassAsset grassAsset)
        {
            await _grassComponent.GrowFromAssetsAsync(grassAsset);
        }
    }
    

    Synchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private GrassComponent _grassComponent;
    
        public void GrowGrass(GrassAsset grassAsset)
        {
            _grassComponent.GrowFromAssets(grassAsset);
        }
    }
    

    Growing a patch of grass from a specific grass asset at a given position

    Asynchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private GrassComponent _grassComponent;
    
        public async Task GrowGrassAsync(GrassAsset grassAsset, Vector3 globalPosition)
        {
            Vector2Int positionInstance = _grassComponent.GetNearestInstance(globalPosition);
    
            await _grassComponent.GrowFromInstancesAsync(grassAsset, positionInstance);
        }
    }
    

    Synchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private GrassComponent _grassComponent;
    
        public void GrowGrass(GrassAsset grassAsset, Vector3 globalPosition)
        {
            Vector2Int positionInstance = _grassComponent.GetNearestInstance(globalPosition);
    
            _grassComponent.GrowFromInstances(grassAsset, positionInstance);
        }
    }
    

    With a prototype

    Growing all the grass related to a specific prototype

    Asynchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private GrassComponent _grassComponent;
    
        public async Task GrowGrassAsync(int prototypeIndex)
        {
            await _grassComponent.GrowFromPrototypesAsync(prototypeIndex);
        }
    }
    

    Synchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private GrassComponent _grassComponent;
    
        public void GrowGrass(int prototypeIndex)
        {
            _grassComponent.GrowFromPrototypes(prototypeIndex);
        }
    }
    

    Growing a patch of grass from a specific prototype at a given position

    Asynchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private GrassComponent _grassComponent;
    
        public async Task GrowGrassAsync(int prototypeIndex, Vector3 globalPosition)
        {
            Vector2Int positionInstance = _grassComponent.GetNearestInstance(globalPosition);
    
            await _grassComponent.GrowFromInstancesAsync(prototypeIndex, positionInstance);
        }
    }
    

    Synchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private GrassComponent _grassComponent;
    
        public void GrowGrass(int prototypeIndex, Vector3 globalPosition)
        {
            Vector2Int positionInstance = _grassComponent.GetNearestInstance(globalPosition);
    
            _grassComponent.GrowFromInstances(prototypeIndex, positionInstance);
        }
    }