Hello , this is Mahsa
I wanna pickup some objects , for example some (logs) , and I want them to be like this →
I have two list : list number 1 and list number two, when I pickup the log number 1 I want to go to the list number 1, then when I pickup log number 2 I want to go in list number 2, and collecting logs happening in a IEnumerator.
private IEnumerator MoveLogToLogStack(ResourcesData log)
{
WaitForEndOfFrame wait = new WaitForEndOfFrame();
float timer = 0;
float duration = 0.3f;
var lastTileLocalPos = Vector3.zero;
if(inputLogList_1.Count > 0)
{
lastTileLocalPos = inputLogList_1.Last().stackLocalPosition;
}
log.stackLocalPosition = lastTileLocalPos + Vector3.up * log.logHeight;
log.transform.parent = logStackPoint_1;
var startPos = log.transform.localPosition;
log.CanCollect = false;
inputLogList_1.Add(log);
while(timer < duration)
{
timer = Mathf.Min(timer + Time.deltaTime, duration);
float t = timer / duration;
var targetPos = lastTileLocalPos;
var position = Vector3.Lerp(startPos, targetPos, t);
position.y += animationCurve.Evaluate(t);
log.transform.localPosition = position;
yield return wait;
}
}
This just goes in the first list
"then when I pickup log number 2 I want to go in list number 2" - your code has only references to inputLogList_1 - so how would it be possible to add your item to some other list? Also, what exactly are you trying to do? What is the purpose of "list 1" and "list 2" / I have no idea.
– esesI wanna collect items in two rows
– MoinyMaybe add an image what you are trying to do TBH the question isn't very clear.
– eses