Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Simple Waypoint System (SWS) - Move objects along paths

Discussion in 'Assets and Asset Store' started by Baroni, Dec 10, 2011.

  1. pinchmass

    pinchmass

    Joined:
    Jul 2, 2012
    Posts:
    156
    Brillant support as always, sorry I did start looking through the thread, but it was about 5 in the morning and thought I'll just ask (knowing how fine your support is)

    I'll have a go at that now thanks again your a star.
     
  2. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Reporting a problem in hoMove.cs, the EaseType conflicts with iTweenExtension if it is present.

    public EaseType easetype = EaseType.Linear;
     
  3. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hmm what error message do you get?
    In iMove.cs I use

    Code (csharp):
    1. public iTween.EaseType easetype = iTween.EaseType.linear;
    which works fine.
     
  4. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    iTweenExtension has a EaseType too, so in hoMove, you should be using Hoville.HoTween.EaseType instead (typing from memory, not at computer) else it does not know which one to choose.
     
  5. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Ah, the native iTween plugin... I see. Thanks, will be changed in the next version.
     
  6. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hello all,

    just a quick heads up:

    I'm on vacation beginning August 21 and will be back on August 29.
    Please note that support inquiries won't get a reply within this period, but this does not affect sales operations.

    Don't miss our promotional offer!
    Only valid for this month. Save $15!


    Regards,
    Baroni
     
  7. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,239
    Yey! Vacation time! Have a happy and awesome one! :)
     
  8. IOZO

    IOZO

    Joined:
    Jun 26, 2010
    Posts:
    55
    Hello,

    I purchased SWS a few time ago and we're very happy with it.
    Until today I was using a 2.0 version and just updated to 2.1.

    We're using it for animating platform, and enemies though various Path and also to stick the hero to a predifined Path.

    For this last one I used some custom scripts to follow the path but also to jump from path to path (when the hero jumps from a Platform for instance.
    I saw that you added some runtime scripts in the new version but before I dig into it I was wondering if you added some extra features for what I need).

    Basically I need 2 things :

    1. Snap the hero to the closest position on the closest Path when I respawns (i.e getClosestPath(in Vector3, out Vector3, out PathID)
    2. when the hero jumps (I want him to still follow the path as naturally as possible and get back on track when he lands).

    Would you have any input to help me optimize these 2 behavior with the latest version ?

    thanks
     
  9. nielsvaes

    nielsvaes

    Joined:
    Jul 29, 2012
    Posts:
    18
    I think I found a minor bug in the hoMove script, don't know if it's up to you to fix it though :) If you click on the "Show Message Settings" button, you can't change any of the Parameters in the rest of the script. Stuff like changing the speed, Look Ahead or Eastype values no longer works. If you click Hide Message Settings, everything can be changed again.

    I assume this has something to do how Editor control work?
     
  10. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hi IOZO,

    I'm glad you like it. Thanks for your patience, just came back home yesterday.

    1. When using iMove / iTween, this should be no problem to program. You could make a sphere collision check for finding the nearest waypoint, then compare the waypoint with the path waypoints and set the currentPoint variable of iMove accordingly. In hoMove, my implementation does not allow this easily, as the whole path gets looped through in NextWaypoint(). E.g. if the walker object should start somewhere in the middle, the "point" variable has to be set to the desired starting index.
    2. A jumping behavior would obviously require overwriting the height / y value of the object - which is not intended neither in iMove nor in hoMove. However it may be possible in iTween, when already tweening the object. Try changing the position in Update() or LateUpdate() to simulate a jumping curve. hoMove uses partial tweens that are calculated before tweening, the object then simply follows the path from one waypoint to the next. I don't see how overwriting this pre-defined tweening curve by a jumping behavior could be possible, but maybe Daniele, the author of HOTween has a clue. I'm sorry that these aren't really the best answers.



    Hi Niels,

    I'm aware of this issue, it has indeed something to do with the editor integration. Maybe my undo-redo handling is blocking the rest of the components, or it can't handle that much layout properties... either way, I hope this does not affect your workflow that much.

    :)

    Regards,
    B.
     
  11. DamianGto

    DamianGto

    Joined:
    Apr 20, 2011
    Posts:
    159
    I did buy this and I hope to learn it fast.
    I also hope the playmaker actions will be more and has some document how to use them.
    That was one reason I did buy this for it had playmaker actions on it.
    I hope it will still be developed, as I do not see there has not been much talk here in 3 weeks.
     
  12. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hi DamianGto,

    thank you for your honest feedback. We're working on our tower defense kit lately (see my signature), so not much talk in here means not many problems, which is quite good :) I asked about playmaker actions a while ago: post
    Changing the speed of a running tween is not that easy, this action is still missing. What actions do you need? I'll write up a quick document on how to use existing actions in the near future.

    Regards,
    B.
     
  13. DamianGto

    DamianGto

    Joined:
    Apr 20, 2011
    Posts:
    159
    No problem.
    I still learning and right now I learn ITween. Right now I do use Playmaker for it, but I will learn more about this system and see what benefit it has.
    So I have a little hard time to ask what I need, for I do not know yet.
    One thing I did see was kind of weird and that was when I do a 2.5D I must add a block or something so I can make the path then remove the block.
    I hope I did understand this correct. But in that case I do not understand why you must add that block. seams a useless steep.

    Tanks for your work.
     
  14. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    The waypoints have to be placed on something, that's why you need some sort of "background" object in your 2.5D scene. It can be anything with a collider on it, for example your world objects, it doesn't have to be a block. Imagine you have an empty scene and want to place new waypoints. If you click somewhere, the path script does not know where to create these new waypoints regarding depth. They could be right before the camera, or 10.000 feet far away.

    If you create a path in 3D space (on terrain, roads, etc.), it's clear where to create new waypoints, as the mouse position holds x,y,z coordinates.
     
  15. kamakura_1192

    kamakura_1192

    Joined:
    Nov 10, 2012
    Posts:
    2
    Is there a way to change the "message setting" by using the script?

    (Sorry, I use the translation google ...)
     
    Last edited: Nov 10, 2012
  16. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hi kamakura,

    yes, look out for the variable "_messages" in either hoMove.cs or iMove.cs, depending on which you are using.
    "_messages" is a list of the MessageOptions class, defined in WaypointManager.cs.

    First, click on the "Show Message Options" button of the object you want to change via script later. This will initialize the messages list (automatically done through hoMoveEditor.cs or iMoveEditor.cs). Next, you can program something like this to change the messages:

    Code (csharp):
    1. //in a new script attached to the gameobject
    2. //get reference of movement script
    3. hoScript hoMove = gameObject.GetComponent<hoMove>();
    4.  
    5. //modify messages. usage:
    6. //_messages[waypoint number]."property"[message number]
    7. //for example:
    8.  
    9. //call method "myMethodToCall" at the 1st waypoint in the 1st message
    10. hoScript._messages[0].message[0] = "myMethodToCall";
    11. //change its property type to an object
    12. hoScript._messages[0].type[0] = MessageOptions.ValueType.Object;
    13. //pass in this gameobject as argument for the method
    14. hoScript._messages[0].obj[0] = gameObject;
    In my example the code achieves this result:
    (gameObject is "Capsule5")



    You can also have multiple messages per waypoint, this requires you to add a new slot to the list first. Let me know if you need further help!
     
  17. kamakura_1192

    kamakura_1192

    Joined:
    Nov 10, 2012
    Posts:
    2
    Thank you very much. :D
     
  18. SkaiCloud

    SkaiCloud

    Joined:
    Aug 10, 2011
    Posts:
    53
    Please help. I just purchase SWS and I have a prefab object that has the iMove component to it. I'm trying to access waypoint 9 method but it didn't work for me.

    here is my code:
    Code (csharp):
    1.  
    2. iMove MoveScript = gameObject.GetComponent<iMove>();
    3. MoveScript.SetPath(WaypointManager.Paths["SpawnToWait"]);
    4. MoveScript._messages[8].message[0] = "WaitForPlayerChar";
    5. MoveScript.StartMove();
     
  19. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hi SkaiCloud,

    I'm guessing you're getting a null reference exception because the message on waypoint 9 can't be accessed? The messages list has to get populated before calling or setting messages. This happens in StartMove(), so the easiest fix would be to switch the order to

    Code (csharp):
    1. ...
    2. MoveScript.StartMove();
    3. MoveScript._messages[8].message[0] = "WaitForPlayerChar";
    where you have to make sure that StartMove() was fully executed, maybe insert a WaitForSeconds(.5f) in between. Please let me know if this solves the problem.

    Regards
     
  20. SkaiCloud

    SkaiCloud

    Joined:
    Aug 10, 2011
    Posts:
    53
    Hi Baroni, I wanted to make sure I fully tested this on my end before I get back to you. Unfortunately I'm getting ArgumentOutofRangeException The A.I move along it's path but once it reach the end of the path it gets a ArgumentOutofRangeException
     
  21. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hi SkaiCloud,

    I forgot two important things, I'm sorry for any inconvenience caused.

    1. SetPath(...) automatically calls StartMove(), so you don't have to manually call it.
    2. Every message expects a type, if you don't want to have one - then there's the type MessageOptions.ValueType.None. You have to add this type to the message before calling it at runtime. Finally the code looks like this (tested and working):

    Code (csharp):
    1. iMove MoveScript = gameObject.GetComponent<iMove>();
    2. MoveScript.SetPath(WaypointManager.Paths["SpawnToWait"]);
    3. MoveScript._messages[8].message[0] = "WaitForPlayerChar";
    4. MoveScript._messages[8].type.Add(MessageOptions.ValueType.None);
    I am aware that these methods aren't easy to understand at this point in time and in the following two weeks I'll try to make messages more convenient to use at runtime.
     
  22. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    411
    Hi Baroni, i recently got SWS.... and i LOVE it man!!! Great, great tool that even i can understand.
    Questions:
    - Is it possible to set different starting points for different objects following the same path with HoMove?
    - when using SWS for a racing game (here is my test room) i get small hiccups when passing each waypoint when using linear easing. What am i doing wrong?
    - how can i switch paths with user input (imagine a path for each lane and switching with keyboard oldskool game&watch style)?

    PS: i didn't read the topic, if any of the questions is already answered, just say it I'll dig!

    Did i mention how awesome SWS is?
    Thank you!!!!
     
  23. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hi nukeD,

    that's great to hear, thanks! Would you mind writing a review on the Asset Store (in case you've bought it there) at a later time? :)

    This may be possible, but it's not integrated at the moment. I tried it a while ago and really messed up the code so I left it unchanged. I can't give you code examples, because this addition is quite complicated and needs some changes to existing code, but I'll take it as a feature request for the next maintenance update planned for december.

    Nice game! I like the art and car design. You're doing nothing wrong. There are two checks in hoMove that are responsible for delaying the object at a waypoint. If your objects are moving very fast, this might be visible. If you don't use waypoint delay at all, try commenting out these lines in the method NextWaypoint():

    Code (csharp):
    1.             //execute waypoint delay
    2.             yield return StartCoroutine(WaitDelay());
    3.  
    4.             //check for pausing and wait until unpaused again
    5.             while (waiting) yield return null;
    You can switch paths using SetPath(PathManager newPath) or SetPath(WaypointManager.Paths[newPath.name]). However this will either directly position the object at the first waypoint or it starts moving to the first waypoint of the new path, depending on if "moveToPath" is ticked. Please have a look at the runtime example. Switching the path of an object to the same progress value of another path is not implemented because I could not make sure that the overall stability can be guaranteed (quite inflexible code, not fitting to every use case).

    Regards,
    B.
     
  24. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    411
    Already done :)

    In that case, would it affect performance if i use a separate (copy/paste) path for each object (for example 6-9 cars)?

    It worked, no more hiccups! Amazing!

    hmm... and if we have, lets imagine 3 parallel paths with same number of waypoints numbered in the same way... and... we switch the position of the car by switching the path names instead, so the object moves to its new 'real' parent or... well, im thinking out loud here (and obviously i've no idea on how code works).

    Thanks for the fast and kind reply!
     
    Last edited: Nov 23, 2012
  25. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Not that much. The almighty author of HOTween really optimized tweening from the ground up. You shouldn't see a performance impact until there are hundreds of simultaneous tweens.

    I think I know what you mean. Problem is, that every path gets generated on start and exists in world space. Another path has completely different waypoint positions in world space. Currently there is no way to tell an object "get position on your path and put it at the same position on the other path". HOTween's documentation has methods for starting a tween at a given time on the path (GoToAndPlay()), but I don't know how that would interfere with my implementation.
     
    Last edited: Nov 23, 2012
  26. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    411
    OK, what do you think about this:
    Is it possible to attach an object object (the car) to the path with a 'rubber band'? On the curves the object swings on the outside, but as the momentum decreases it returns closer to the path... The 'elasticity' can be changed... but the most important part is that the player can move the object laterally as far as the rubber band allows (i imagine a water ski attached with a bungee rope like behavior). That way we can create cool 'arcade' gameplay of avoiding obstacles, collecting items, fake 'drifting' for score and a million other things.

    Maybe something derived from this (00:10 > 00:21)?


    Yes, i tend to get carried away very easily, but what do you think?

    Thanks for your time Baroni!
    Have a great weekend!
     
    Last edited: Nov 23, 2012
  27. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Haha, great idea.

    Actually I've ran a quick test and that's definitely possible. I suggest you look up the documentation on joints:

    http://www.youtube.com/watch?v=y2sSQwTBZKY&feature=player_embedded

    http://docs.unity3d.com/Documentation/Components/comp-DynamicsGroup.html

    Let an object with a rigidbody (gravity disabled) follow the path. Then, attach a rigidbody and a (spring, or hinge) joint to your car. Drag drop the path follower object in the car's joint. Now, the car should follow its path with some water ski-like physics. Adjust the variables until you are satisfied with the result. Next, write a script that applies left / right forces to the car! That's the first idea that came to my mind.

    Have a nice weekend too!
     
  28. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    411
    Wow man, your idea is great! I'll work on it... if i can pull it off it would be super cool for my 'arcade style' control!
    Can i try doing this with PlayMaker, since... i never learned to read... code?

    Thanks a lot!
     
  29. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    847
    I don't know if this is common sense, but in one of my latest projects (which proved to be no fun despite having sunk several weeks into it) I used empty GameObjects to follow a path rather than the "proper" actors in the scene who instead follow the empty placeholders. That way, you have both the advantages of the waypoint system with its various path settings (loop type, delays etc) and the freedom to change paths or placeholders on the same path without too much hassle.

    Just an unrelated suggestion. :)
     
  30. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    :) yeah, should work fine with PlayMaker. The most methods are SendMessage() compatible, but there are also three PlayMaker actions included in SWS (SWS > Scripts > PlayMaker > zip file).

    Never really thought about something like that - may be very useful, much appreciated! Good to see you're still around.
     
  31. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    847
    I might not have too much input nowadays, but I am still using your asset on a regular basis and keep checking the thread for updates. ;)
     
  32. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    411
    Thanks a lot guys, your guidance and ideas are a big help!!
     
  33. dsjunnesson

    dsjunnesson

    Joined:
    Dec 3, 2012
    Posts:
    15
    hey,

    I just bought your system but have some troubles with it. I need to have the waypoints inside of a parent game object that is rotating and scaling and the waypoints needs to follow with. It is a AR system based on http://www.metaio.com/ that Im building up. Basically the code on the parent is this.

    // Apply rotation
    Quaternion q;
    q.x = trackingValues[3];
    q.y = trackingValues[4];
    q.z = trackingValues[5];
    q.w = trackingValues[6];
    transform.rotation = q;


    // Apply translation
    Vector3 p;
    p.x = trackingValues[0];
    p.y = trackingValues[1];
    p.z = trackingValues[2];
    transform.position = p;

    The current behavior seems to be that the waypoints just stick to its initial position instead of dynamically updating. For example this can be tested by putting the Walkers and Waypoints manager inside of a parent and then move the parent with a simple

    transform.Translate(Vector3.up * Time.deltaTime*5);

    Any help would be really appreciated.
     
  34. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hi,

    you're right, a path does not update its position. iTween and HOTween create a tween with a starting and ending point between waypoints. For movement with moving waypoints, these plugins would have to update their properties each frame. This is not their intended use, because they are meant to animate objects between different positions. Updating their properties in every frame would drastically decrease performance. If you want to update something every frame, it's easier to use Unity's built-in methods such as Update().

    If our product isn't useful in any other way, you could issue a refund by mailing to the Asset Store team.

     
  35. dsjunnesson

    dsjunnesson

    Joined:
    Dec 3, 2012
    Posts:
    15
    that is most unfortunate to hear.

    I dont think your product will be a valid tool for me then and I will have to try to create my own version of it.

    This Asset store refund how does that work? Which email am I supposed to send to?
     
  36. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Sorry. Try mailing your contact details and transaction ID at assetstore@unity3d.com. Good luck with your AR system :)
     
  37. dsjunnesson

    dsjunnesson

    Joined:
    Dec 3, 2012
    Posts:
    15
    Being slightly stubborn I poked around with the code to see what HoTween could do and I think I might have solved my problem. Instead of supplying using the parameter

    tParms.Prop("position", plugPath);

    when creating the HoTween path I used

    tParms.Prop("localPosition", plugPath);

    which seems to give me the correct behaviour with the object following its waypoints inside of the parent. Just need to fix the lookAt which broke and is being ignored right now when doing it this way but it is a step forward at least.
     
  38. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Wow, thank you very much for being stubborn, just tried it out! I must admit that I wasn't aware of this functionality in HOTween with parented objects. This means that camera paths around a moving car are actually possible... (had that request a while ago). I saw that lookAt is broken, going to investigate now too. Instead of using HOTween's orientToPath setting, you could also access the current waypoint position via wpPos[currentPoint] and use Unity's lookAt.
     
  39. dsjunnesson

    dsjunnesson

    Joined:
    Dec 3, 2012
    Posts:
    15
    stubborn sometimes is a good thing in coding. :)

    If you find a solution for the lookAt let me know. I will poke around some more to try to figure out how to solve it. This is my first Unity project so still learning as I go.
     
  40. matrix211v1

    matrix211v1

    Joined:
    Jan 20, 2009
    Posts:
    193
    This may be part of the same question. Here is what I need to do.

    I have one path with 10 Waypoints. I need an object to start off on a random Waypoint (between points 4 through 6) and then, when clicked, move either up to 4 waypoints to the right or left. I only need to use iMove and not hoMove.

    Is that possible?

     
  41. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hi matrix211v1,

    in iMove there's a variable in the inspector named "currentPoint". You can set this variable via script to be 3 or 5 (array index) and then call StartMove() afterwards. However, starting from that point your object will only move to the end of the path. In PathEditor.cs, you'll find a method for inverting the direction of the path. So when starting from waypoint 4 and moving to the left, you could invert the direction of the path by accessing PathManager.cs and swapping the waypoints.

    Wouldn't it be easier to just create 2 separate paths and have a script randomly call one of these via SetPath(...)?
     
  42. dsjunnesson

    dsjunnesson

    Joined:
    Dec 3, 2012
    Posts:
    15
    would it be possible to dynamically create a set of waypoints from for example a xml document on startup. So basically create the prefab waypoints on the fly.
     
  43. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Sure, why not. But I don't have a clue how to setup xml files, I can only tell you what's needed for creating paths manually:

    -Once you instantiated all waypoint gameobjects, attach a PathManager component to their parent.
    -Access the PathManager and set its waypoints array to the list of instantiated waypoints.
    -Add the path to the WaypointManager via WaypointManager.AddPath(GameObject path).

    Now you're good to go, SetPath() and all other movement methods should work fine. Btw, did you read my private message?
     
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Christmas rebate incoming: 30% off all our products!

    Announcing Version 2.1.2 (Pending review) - Release notes:

    Fixes Changes
    • hoMove: skips unnecessary delay yield if no delay was set in the inspector
    • iMove/hoMove: message initialization refactored to be runtime compatible
    • PlayMaker readme added to SWS > Scripts > PlayMaker
    • HOTween: updated to version 1.1.724, now supporting linear paths and tweening parented objects + much more - thanks to the author for a generous cooperation! -
    • New “RotatingPath” in scene “Example_Curved” demonstrates local tweens
    • Documentation: updated to explain new runtime methods

    Features
    • Methods to change speed and populate messages at runtime added
     
  45. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Version 2.1.2 has been accepted and is available on our stores out now!

    Back to first post...
     
  46. matrix211v1

    matrix211v1

    Joined:
    Jan 20, 2009
    Posts:
    193
    Is there a way to restart iMove? Such as I have an object following a Waypoint Path that has 5 Waypoints. Due to a condition, while it is part way to Waypoint 3, I need it to teleport and start over?
     
  47. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hey matrix211v1,

    try the Reset() method combined with messages at waypoint 3 (if you want to start over exactly at that position). A message will call your condition in your own script, then Reset() restarts at the first waypoint.
     
    Last edited: Dec 12, 2012
  48. matrix211v1

    matrix211v1

    Joined:
    Jan 20, 2009
    Posts:
    193
    Hello!

    Sorry to be a bother, but I'm getting a NullReferenceException when I run this code:

    Code (csharp):
    1. MessageOptions opt = myIMove.GetMessageOption(0,0);
    For my path, I only have a WaypointStart and WaypointEnd.

    It's failing on

    Code (csharp):
    1. if (_messages.Count < waypoints.Length)
    under InitializeMessageOptions in the iMove.

    Thanks.
     
  49. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hi matrix,

    actually I'm glad about any requests :)

    I assume you call this part either in Awake() or Start()? It's failing because at the time of execution your object has no path, thus waypoints.Length returns null. You have two options: When the object does not get instantiated at runtime, simply set all messages in the inspector. Or, wait a short delay before calling this code, e.g. by using

    Code (csharp):
    1.  
    2.     IEnumerator Start()
    3.     {
    4.         yield return new WaitForSeconds(1f);
    5.     ....
    6.  
    I also saw that I left two debug messages in GetMessageOption(), will release another version without these shortly. No need to update otherwise.
     
  50. matrix211v1

    matrix211v1

    Joined:
    Jan 20, 2009
    Posts:
    193
    Actually I am not calling it from either Awake or Start. I am waiting 4 seconds, then I am calling this:

    Code (csharp):
    1. return Instantiate(VictimsList[random]) as GameObject;
    Then the return is here:

    Code (csharp):
    1.         PathManager Path = GameObject.Find("Path_" + RandomPath.ToString()).GetComponent<PathManager>();
    2.         Victim.GetComponent<iMove>().pathContainer = Path; 
    3.        
    4.         iMove myIMove = Victim.GetComponent<iMove>();
    5.         if(myIMove == null)
    6.         {
    7.             Debug.Log("I am null");
    8.         }
    9.         else
    10.         {
    11.             Debug.Log("I am not null");
    12.         }
    13.        
    14.         MessageOptions opt = myIMove.GetMessageOption(0,0);
    I am not sure what a delay is going to do unless it is a problem when I use Instantiate and the iMove is not ready. As you can also see, I have my Path set before I call the MessageOptions.

    I guess another option would be to Instantiate, then AddComponent of iMove, then set the values?
     
    Last edited: Dec 20, 2012