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 a tree manually

    Global

    Growing all the trees

    Asynchronous operation

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

    Synchronous operation

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

    Growing a tree instance

    Asynchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private TreeComponent _treeComponent;
    
        public async Task GrowTreesAsync(int indexTreeInstance)
        {
            await _treeComponent.GrowFromInstancesAsync(indexTreeInstance);
        }
    }
    

    Synchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private TreeComponent _treeComponent;
    
        public void GrowTrees(int indexTreeInstance)
        {
            _treeComponent.GrowFromInstances(indexTreeInstance);
        }
    }
    

    Growing a tree at a given position

    Asynchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private TreeComponent _treeComponent;
    
        public async Task GrowTreesAsync(Vector3 globalPosition)
        {
            int indexTreeInstance = _treeComponent.GetNearestInstance(globalPosition);
    
            await _treeComponent.GrowFromInstancesAsync(indexTreeInstance);
        }
    }
    

    Synchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private TreeComponent _treeComponent;
    
        public void GrowTrees(Vector3 globalPosition)
        {
            int indexTreeInstance = _treeComponent.GetNearestInstance(globalPosition);
            
            _treeComponent.GrowFromInstances(indexTreeInstance);
        }
    }
    

    With a tree asset

    Growing all the trees related to a specific tree asset

    Asynchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private TreeComponent _treeComponent;
    
        public async Task GrowTreesAsync(TreeAsset treeAsset)
        {
            await _treeComponent.GrowFromAssetsAsync(treeAsset);
        }
    }
    

    Synchronous operation

    using System.Threading.Tasks;
    using SoyWar.SimplePlantGrowth;
    using UnityEngine;
    
    public class MyComponent : MonoBehaviour
    {
        [SerializeField] private TreeComponent _treeComponent;
    
        public void GrowTrees(TreeAsset treeAsset)
        {
            _treeComponent.GrowFromAssets(treeAsset);
        }
    }
    

    With a prototype

    Growing all the trees related to a specific prototype

    Asynchronous operation

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

    Synchronous operation

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