FAQ Database Discussion Community


Using yield WaitForSeconds() in a function returning void

c#,unity3d,wait,void,yield-return
I have a jumpscare in my game. I am using Unity 3D. My first function is public void ScareMe(Vector3 pos) { //it does some necessary irrelevant //stuff and then it invokes another function Invoke ("Smile",.2f); } In my other function I want to make an object appear and then disappear...

Getting words out of a text file with C#

c#,text-files,ienumerable,yield-return
I want to apologize for my beginner mistakes and english. I have write a method that gets words that start with a "b" out of a randomtext file and return a IEnumerable. It has to work with a yield return. The problem is that i don't know how to write...

Coroutine Won't Yield

c#,unity3d,coroutine,yield-return,ienumerator
I can't figure out for the life of me why this coroutine won't yield. This section of code... while(angle > 1.0f) { my_transform.rotation = Quaternion.Slerp(my_transform.rotation, fwdRotation, Time.deltaTime * 2.0f); angle = Quaternion.Angle(my_transform.rotation, fwdRotation); Debug.Log ("Inside loop" + angle); yield return null; } ...won't yield. It just goes right through it....

TypeError: 'generator' object has no attribute '__getitem__'

python,python-2.7,dictionary,yield,yield-return
I have written a generating function that should return a dictionary. however when I try to print a field I get the following error print row2['SearchDate'] TypeError: 'generator' object has no attribute '__getitem__' This is my code from csv import DictReader import pandas as pd import numpy as np def...