Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity wrap around value

// Wraping around an array or list
currentIndex = (currentIndex + 1) % myList.Count; // Forward
currentIndex = (myList.Count + currentIndex - 1) % myList.Count; //Backward
 
PREVIOUS NEXT
Tagged: #unity #wrap
ADD COMMENT
Topic
Name
7+4 =