Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Realistic FPS Prefab [RELEASED]

Discussion in 'Assets and Asset Store' started by Azuline-Studios, Apr 5, 2013.

  1. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    241
    Hey Tony,
    Hey Tony Thanks for looking at this for me. Still no luck on my end. banged against it all night. When I do a fresh project, there are no errors and everything LOOKS fine, until I get to action mapping. Before all the RSFP actions would just pop up in the actions category and I could easily map buttons to actions, now I get NO RFPS actions. Just blank. I have everything set to the default action category.

    When I try and access an old version of the build that worked fine with the older version of rewired I get the following errors:

    Assets/RFPSP/Scripts/Weapons/WeaponPivot.cs(13,17): error CS0246: The type or namespace name `InputControl' could not be found. Are you missing a using directive or an assembly reference? (get this error on 16 different RFPS scripts)


    Rewired: Unable to find class Rewired.Editor.UnityEditorBridge! You may see this error if you have compile errors in other scripts when you start Unity. Fix the compile errors. If you have no other compile errors, please reinstall Rewired.

    So now I am wondering if I got a corrupt download of rewired and/or if its a Unity/rewired versioning issue. I'm still on 5.4.03f of Unity. (1.24 of RFPS and whatever is the current version of rewired 1.11????) What version of Unity are you currently on? Tomorrow when I am back on the high speed (Currently on a plain old 56k dial up ) I'll redownload rewired and check and then may upgrade Unity to 5.6.....

    This will teach me to upgrade assets in the middle of a build and/or not read the release notes before upgrading!!!!!! It was all working so well last week ! :)

    In the mean time, I'm going to try your exploding arrows script today. See how that all works .... Onward!~
     
  2. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    164
    i'm trying to get the objective to trigger as it is a sphere collider but i cannot shoot enemies within the collider :/. What layer would i need to use to make sure that it doesn't interfer with the game?
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,867
    @jons190 - It could be a version issue. Try deleting the unitypackage from your cache folder and re-downloading it.
    • Windows: [AppData]\Roaming\Unity\Asset Store-5.x\
    • Mac: ~/Library/Unity/Asset Store/
    I tested with Unity 5.5.0, RFPS 1.24, and Rewired 1.1.0.0.


    EDIT: I forgot to mention: If you're still getting any red errors in the Console window, this may prevent the Rewired editor from loading properly.

    Also, I know it would be a big pain, but would it work to manually add those actions back in? Or perhaps reimport the prefab from my integration package? My prefab isn't great; it doesn't have all the mappings, but it at least defines all the actions that RFPS uses.
     
    Last edited: Apr 10, 2017
  4. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,459
    Did you follow the steps on updating Rewired that is mentioned in the Rewired documentation?

    http://guavaman.com/projects/rewired/docs/Updating.html
     
  5. Arealjighead

    Arealjighead

    Joined:
    Apr 7, 2017
    Posts:
    32
    Azuline-Studios likes this.
  6. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    38
    Thanks so much that honestly mad my day. Ya I bought RFPS almost around 9 months ago maybe more having a bunch of failure ideas but it was all worth it to get to this point. I have many things Planned for Rupture. I do plan on getting Tony's save system for my weapons but I still need to learn how to enter a trigger in a scene (trigger that is around or on gun) that will trigger it to spawn in a hub world scene (in some kinda gun vault that has all the guns you've found so far) for now on when you go back to the hub world it will be in the vault. I want to do this so I can have a ton of weapons like you'd have in Dark Souls so that you'll have like 5 maybe more weapons you can carry at Max and then you switch them at the vault when needed. But yea since I have no idea to code im often asking questions xD I think Tony told me how to do it and I thank you Tony (and im truly sorry I don't really understand what you exactly said I think it needs to be dumbed down for me rip... But thanks for all the help Tony your the best.
     
    Azuline-Studios likes this.
  7. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    Nothing in the new version of Rewired breaks anything during installation. It's 100% compatible with all previous versions. The only way something bad could happen during an upgrade is if:

    1. You did not upgrade correctly as detailed in the Updating Rewired documentation. If you moved the Rewired folder and upgraded over it in that state, everything will break because Unity will import multiple copes if every Rewired asset. This is a Unity issue since 5.0. (It would not cause data to be lost, however.)
    2. Serialized data corruption occurred. This is also a Unity issue and they are aware of it and have stated it will be fixed in Unity 2017. It is detailed in the Known Issues documentation.

    The solution to both issues is to completely delete the Rewired folder (all copies you may have in your project) and reinstall it. Do not save any scene until you have closed and re-opened the Unity Editor after reinstalling Rewired.

    Any extras you may have installed such as Unity Input Override must be reinstalled.

    Rewired gets very frequent updates with new controller support, new platform support, added features, bug fixes, and more. If you lock your project to the asset version you originally installed, you're almost guaranteed to run into bugs that have been later fixed and miss out on important new additions. The proper advice is to always back up your project before updating plugins or Unity. (Updating Unity can also cause data corruption.)
     
    Last edited: Apr 11, 2017
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    All the Actions stored in a Rewired Input Manager are stored in that GameObject as standard Unity serialized data. None of this data is stored in the Rewired folder and none of it is touched by an upgrade. If Actions disappeared from a Rewired Input Manager after upgrading, the only possibility is that serialized data was corrupted by Unity. Otherwise, be sure you are using the same Rewired Input Manager as before and that you are not editing a copy of a prefab of that Rewired Input Manager.

    You can see all the serialized data stored in the Rewired Input Manager by changing the inspector mode to Debug. You can send me the Rewired Input Manager (just make a prefab out of it or copy it to a new blank scene) and I will take a look and see what data is stored in it.
     
  9. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    The Actions for RSFP will only appear if you are editing a Rewired Input Manager that already has those Actions created. Are you opening the Rewired Input Manager that Tony Li included in this integration post?


    A script must have been deleted that contains the InputControl class. This is not a Rewired class.


    This error happens when you have an editor script that is not compiling and you first start Unity. Rewired tries to get some information from its editor side and cannot because the editor scripts cannot compile. This is nothing but a cosmetic error and it will go away when you fix your other editor script errors.

    Edit: I was just made aware of another possibility from another support issue by email today that would cause this error to be shown:

    Upgrading to Unity 5.6.0 causes editor scripts to not be re-imported correctly and compiler errors in editor scripts are not reported to the user. Instead the user only sees this message from Rewired which is not the cause of the issue but rather a result of it. Re-import an editor script by right-clicking on it and selecting "reimport", then you will be shown the real compiler errors which are in turn causing the Rewired editor script to fail. (To be clear, the error is not caused by Rewired, nor is it in Rewired's scripts, but other unrelated editor scripts with compiler errors in the project will cause the editor scripts to not compile and therefore cause Rewired to throw this error because its editor scripts are not being run. This error will be silenced in future releases to avoid confusion since it comes up so often in support issues where Rewired isn't the cause of the issue.)
     
    Last edited: Apr 10, 2017
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,867
    Save System for Realistic FPS Prefab 1.01 Available

    Version 1.01 of the Save System for RFPS is now available on the Asset Store. The only changes from version 1.00 are in the manual and the demo scenes.

    The manual has simpler setup instructions for RFPS 1.25. Now that Azuline has built the OnDie event into CharacterDamage.cs, you no longer need to do that step yourself.

    The demo scenes have been updated for RFPS 1.25.
     
    Azuline-Studios, Weblox and GMax like this.
  11. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    196
    Hi all,

    Anyone using with or know if RFPS Prefab 1.25 is working OK with the latest Unity 5.6 Version?

    Thank you.

    Peter
     
  12. unity-werkstatt

    unity-werkstatt

    Joined:
    Oct 7, 2015
    Posts:
    9
    It works fine
    although there is message in console in play mode but only in fps prefab
    "In order to call GetTransformInfoExpectUpToDate, RendererUpdateManager.UpdateAll must be called first."
    It happens mostly on npc kills or damage
    i didnt have time to test it

    my models with mecanim don't have that issue

    Cheers
     
  13. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    196
    Downloading Unity 5.6 now and will give it a go see how I get on with loading up my RFPS Prefab V 1.23 projects before attempting to update RFPSP. Not sure if that's the best way to do it and try and keep things stable but hopefully I will get it all sorted.

    :)

    Thanks Peter
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,867
    Your RFPSP 1.23 projects will probably report an error in Unity 5.6. Azuline had to update some code (in 1.24+) to accommodate changes in newer versions of Unity.
     
  15. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    196
    Hi Tony,

    Thanks for that. Yes I had followed that here earlier. Having upgraded RFPS prefab projects previously in the switch from V 1.21 to 1.23 I don't know of a way to easily Update everything as when I did that earlier I believe that at that time at least there was not a way for RFPSP to simply update itself internally from within Unity. i.e. A RFPS prefab asset "Update Button" as it were if that makes any sense at all - so at that time when I had just started using Unity and RFPS prefab, not having any major game work developed I lost all projects and started from scratch with the then New RFPS prefab 1.23 version....

    Now like almost 2 years on I have some fairly large levels/projects and don't really want to lose them (I have backups) but don't really know how to update these things to ensure I don't lose my previous work - a matter of trial and error for me in the best procedures if any :-|)

    Peter
     
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,867
    @petercoleman - Sounds like it might be better to stick with your current versions of Unity and RFPSP for your current project. The player prefab in RFPSP 1.25 has some differences. When I tried to use a 1.24 prefab with RFPSP 1.25, the InputControl script reported errors.

    If you want to upgrade, you could try these steps:

    1. Back up your project.

    2. Choose a scene. Make sure the FPS Main instance points to a prefab that isn't the default RFPSP player prefab. That is, if you inspect it and click Select, it should highlight a prefab that you've saved (let's call it "My FPS Main"), not the FPS Main prefab that comes in the RFPSP folder. To save your own prefab, rename the scene's FPS Main instance to My FPS Main and drag it into your own folder.

    3. In the other scenes, make sure you're using this same prefab (My FPS Main). You may need to delete old FPS Main instance in each scene and add an instance of My FPS Main. Before deleting the instance, copy the transform's values so you can paste it into the new My FPS Main instance. At this point all of your scenes should point to your custom My FPS Main instance.

    4. Make another backup.

    5. Upgrade Unity and RFPSP.

    6. Open the RFPSP demo scene and customize the FPS Main instance so it's configured like My FPS Main. Then drag it onto your My FPS Main prefab. This will replace the prefab. Since each scene points to the My FPS Main prefab, it should automatically use the new prefab that you just saved.
     
    Hormic likes this.
  17. petercoleman

    petercoleman

    Joined:
    Feb 21, 2016
    Posts:
    196
    Hi Tony,

    Thanks for that.

    For the moment I have Updated Unity then used a stand alone single level I have to load in. Then Updated RFPS prefab. Currently not tested it extensively but there does not appear to be any "Show Stopper" I had some error messages which I cleared away so the level runs....

    The main issue seems to be that the Updated Unity does not seem to like my Lightmaps and it crashed Unity at least once so have shut it down for now until I can see if I can make any sense out of the Lightmapper which seems to make little now its Updated. Its more complex and partly incomplete or in beta it seems.

    No worries I will get there - hopefully, but thanks again and I will refer to your comments when I get stuck :)

    Peter
     
    TonyLi likes this.
  18. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    241


    Hey Guavan! Thanks for all this info. I'm 100% positive it was me who broke the install. I disregarded all the software development rules regarding updates.

    1)I upgraded in the process of a working project without needing too. (everything was working great for rewired to handle a bluetooth game controller on GearVR)
    2) I did not back up... anything.
    3)I did not read the release notes nor the install docs.
    4) I did not make a test project to test anything before bringing it into my main project
    5) I took the upgrade at like 2 in the morning, after coding about 10 hours straight and was loopy and wasn't at all paying attention to what was going on.

    Anyway, that will teach me! Luckily I followed Tony Li's advice and pulled the old copy of Rewired from /assets on another project and it took just fine. So now I am going to finish the project AND then read the docs on how to upgrade. Again, this was entirely my fault and your plugin it absolutely the best and saved me countless hours of work for getting the bluetooth controllers working on gearvr (the built in Unity input manager never seemed to translate well once it ported over to VR/android and Rewired came HIGHLY recommend from a bunch of mobile VR devs...)

    A question. Will you support the new GearVR controller that just came out this week? I think it has internal motion control so , I'm not sure how that will work through rewired. but it should almost be the same as the oculus controllers, witch I see you now support int he new build.
     
  19. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    @jons190 Thanks for the detailed explanation. I'm glad it working for you now!

    The support in the new release for Oculus and HTC controllers is only for when you are using Unity input as the input source. Unity handles dealing with the native SDKs (Oculus and OpenVR) and exposes an emulated HID joystick through their UnityEngine.Input interface. Rewired's support for this is nothing more than hardware definitions of these virtual devices exposed by Unity.

    Rewired does not support devices that require the use of a special SDK because it's just too much work to integrate and support all these SDKs across lots of platforms, across many versions of Unity and many versions of the SDKs, things always break with version changes, etc. To use those kinds of devices, you need to make a Custom Controller and write a script to pipe the input in.

    I don't see much information about the new GearVR controller, but I'll bet anything it requires it's own SDK just like Daydream, Oculus, etc.
     
  20. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    251
    I was just wanting to do a quick test on an Android device of the sandbox to see roughly where the starting performance was at but I am getting really bad FPS. I was sure I had seen others mention that it runs smoothly so I am not sure what I am missing here. This is running on a Galaxy s6.
    • I disabled all camera effects.
    • I set it to fastest profile and even tried bring textures down to 1/8th
    • I set pixel light to 1
    • it would be running opengles3 and have android min set to 4.3
    • global fog off.
    • I scaled the screen res down.. Hell I even pushed it down to 384x216 and only got about 40fps. Of course the whole things looks terrible like this.
    This can't be right can it?

    Update: I noticed that a script turned a couple of effects back on, so I fixed that and picked up a few more FPS. eg. 384x216 can now hit 50fps. Of course not usable still but progress.
    Perhaps the included sandbox scene itself is just too heavy for mobile.
    Got it to 896x504 and with vsync set for a 30fps. Perhaps that is about right for this scene.
     
    Last edited: Apr 12, 2017
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,867
    That's probably the issue. The scene isn't made for mobile. The particle effects, water effects, models, etc., are designed for desktop.
     
    Baraff likes this.
  22. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    162
    Hey @Azuline-Studios
    I've been trying about physics based bullet (arrow type) but setting them as fast as bullets makes them pass trough ground and enemies! (Doesent deals damage) i tried to change arrow's search for hit thingy too. I even set it to 999. Still same :l
    Also Arrow type bullets always makes spark effect on all types of surfaces!
    Thanks!
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,867
    Does it help to change the arrow rigidbody's collision detection from Discrete to Continuous?
     
  24. emperor12321

    emperor12321

    Joined:
    Jun 21, 2015
    Posts:
    50
    I've been trying to integrate with off-road pickup by torvarld-mgt (only $2 by the way) and unfortunately the car won't move (though the camera will), even when the scene has no rfps player. I added all the input axes, does anyone know what might be the problem?
     
  25. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    162
    Nah :l
    Noticed a game breaker glitch! @Azuline-Studios on TPS view when i look to ground but facing enemy's angle it makes character automaticly hit enemy! When i rotate character (still looking down) away from soldier makes it shoot to ground again.
     
    Last edited: Apr 13, 2017
  26. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,867
    Inspect your projectile prefab (e.g., like Assets / RFPSP / Objects / Weapons Arrow) and try increasing Hit Check Dist.
     
  27. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    241

    Tony hit it. The test scene will play, but NOT AT ALL Optimized for mobile. (all the trees and Aplha channels REALLY SLOW THINGS DOWN) The particle effects and water are also the big culprits. The scene triangle counts come in at WAY over the 100k max for Android with all the 3d models.

    To Optimize for Mobile VR on Android do the following:


    You have to change all the shaders on everything over to mobile. This will help considerably. Use Mobile/defused or Mobile/vertex light as they are the fastest mobile shaders. Also change over all the particle effects(and there are lots buried around and in the code) to mobile/particle additive.

    You also have to turn off all REALTIME LIGHTS and switch to point lights with no shadows or just one directional light (realtime lighting is a HUGE performance lose on android) and bake you light maps and then turn off your point lights after baking.

    On the FPS player, turn off "display visible body" ... and turn off all the fog and sun shaft effects, (not sure yet on the colour correction effects) turn off anti-alesling . In fact, don't turn off, actually remove the components.

    Do not use any alpha shaders in your scene at all. (I think the bullet castings and wall hit marks are all Alpha channel shaders)

    Watch your scene builds and minimize and design for cutting out all Overdraw on geometry.

    In the unity build settings, be sure to set all the optimizations on, turn off all debugging, and do an Occlussion Culling bake (Unity/window/Occulusion Culling) before build.


    This will get you in the range of about 70-80 FPS on Android (s7). I just developed a few VR apps for android and I still get some lag if I don't watch my triangle count in the 3D geometry or have to many monsters/zombies in the view scene or use more then about four particle emitters.....

    Cheers!
     
    Azuline-Studios, Baraff and TonyLi like this.
  28. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    241
    Not sure if I posted this here yet or not...... but just a shout out to everyone on the boards here who gave me such excellent advice on getting this prepab working (with a HUGE shout out to Tony Li)

    Six months ago, I knew nothing about Unity and just took a chance on this prefab helping me boot strap my dev process.
    It's been a wacky journey for sure and it all has worked out(ish). Now I'm just days away from releasing my first GearVR game and at its core is Realistic Prefab (with Tony li's save system) Thanks all! you guys all rock!


     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,867
    Awesome! Congrats, @jons190!

    Will it play on Oculus, too?

    (Is Nerco-Priests a typo?)
     
  30. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    93
    Hi ,

    Nobody knows how to create Player prefab what can be used for instance for multiplayer(Unet/Photon) ? :\
     
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,867
    I recently watched a talk from GDC17, Everything I Said Was Wrong. One of the speakers, Daniel Cook, explained some "bad" advice he had given to indie devs in the past: "Make Your Game Multiplayer".

    He explained why this was bad advice for new devs: "Multiplayer development is sort of like expert game development.... If you've got 4 or 5 games under your belt, you have an amazing technical background, you've built a half dozen multiplayer prototypes in your spare time, you know how to scale servers... then sure, go for it."

    Nobody has replied to you because multiplayer is very complicated and technical. To paraphrase, he said it's 2-10x harder; but I think it's more than that. Cook's updated advice is good: Finish 4-5 single-player games first, develop a strong technical background, and make some simpler (non-RFPS) multiplayer prototypes. Then you'll be in a much better position to make a multiplayer shooter. I'm sure you have lots of great single player ideas in the meantime!

    (Then again, one of the themes of the talk was that people who give out advice aren't always right. But I hope you'll at least consider my suggestion because multiplayer really is a different level of technical complexity from single player.)
     
    chelnok, Hormic and arnesso like this.
  32. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    241
    It should play on Oculus. It's almost the exact same code base in unity and the Rift specs make deving for Mobile look laughable in comparison. So, it should be HIGHLY optimized to play on the Rift. Maybe 120+ FPS? I don't have a Rift so I can't test it.

    Yes a typo! Good catch
     
  33. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    241
    Also, For any interested. I Have this VR experience/game coming out too. It's all based around the Realistic FPS Prefab as well. In fact, all the Golems in-game are running on the default Zombie AI! .....and the four weapons in game, are the Realistic defaults; Sword and Shield, Katana , Knife and Bow..(well they have a few mods anyhow...)


     
    Azuline-Studios, magique and TonyLi like this.
  34. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    162
    That doesnt help
     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,867
    If you use the default, unmodified Arrow prefab and just change the speed, does it work correctly? Or does it have the same problem? If the Arrow works correctly, then check the configuration of your new projectile. Maybe it's missing a rigidbody or a collider.
     
  36. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    162
    Default slow arrows doesnt have any problem. But when i incrase its speed the problem pops up! So i didnt changed any value just speed
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,867
    Sorry, I don't know why. Maybe @Azuline-Studios can help.
     
  38. fernandomedequillo

    fernandomedequillo

    Joined:
    Jan 16, 2017
    Posts:
    3
    Sorry for noob question Does this(RFPS) support level Management? like if i can kill 5 zombies I will then proceed to next level and so on? I am not good at any coding. :) thanks
     
  39. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    251
    It has a wave manager which will do what you are looking for.
     
  40. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    205
    You may want to use PixelCrushers Dialogue System, which offers integration with RFPS and contains a Save System, where you can keep track of your variables used in such things as the "kill quest" that you described. Both RFPS and Dialogue System are written in lua I think, but you don't have to write code from scratch, you can just use the editor for Dialogue System so you won't have trouble with syntax.
     
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,867
    (Thanks for the recommendation, @Deckard_89!) @fernandomedequillo - RFPS is written in C#. The Dialogue System is also written in C#, but it also supports Lua. You can make a game with quests and publish it to mobile app stores without having to type a single bit of Lua. The Dialogue System's editor provides a point-and-click wizard that lets you check and set quest states and counter variables by simply selecting them from dropdown menus. (Under the hood, the wizard automatically generates Lua code that does what you specify in the dropdown menus.) The raw Lua is really just there for people who want to extend the Dialogue System further, for example by integrating it with their own custom scripts.

    If you want to write general quests, the Dialogue System can help. If you only need to spawn zombies in waves, RFPS's built-in Wave Manager will suffice.
     
  42. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    205
    Ah that's it, sorry about that.
     
  43. muhammadadnan0075

    muhammadadnan0075

    Joined:
    Dec 17, 2016
    Posts:
    14
    Greetings! May peace be upon all of you.
    this is my first ever post on this forum and you guys are amazing specially @TonyLi You are the Man :) . Tony i have learned tons of things from you and i owe you a big one.
    By the way what i wanted to say that has anyone noticed that there is a little bug in NPCSpawner.cs on line 47 and 74.
    shouldn't Time.time be replaced with Time.timeSinceLevelLoad.
     
    Last edited: Apr 19, 2017
    Azuline-Studios and emperor12321 like this.
  44. Deki3d-Virus

    Deki3d-Virus

    Joined:
    Dec 11, 2012
    Posts:
    23
    How to fix this error?

    NullReferenceException: Object reference not set to an instance of an object
    AI+<AttackTarget>c__Iterator3.MoveNext () (at Assets/RFPSP/Scripts/AI/AI.cs:927)
     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,867
    Hi @muhammadadnan0075 - Thanks; glad I could help! You're right about NPCSpawner.cs. If it's left as Time.time, the timing will be incorrect in all but the first level. Maybe @Azuline-Studios can fix this for the next release.

    Does your NPC have a NavMeshAgent?
     
  46. Deki3d-Virus

    Deki3d-Virus

    Joined:
    Dec 11, 2012
    Posts:
    23
    yes i have nav mesh agent
    UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

    I think it is error with Couroutines , i use FPS Prefab1.24
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,867
    It's a NullReferenceException, which means the script is trying to use a variable whose value is null (i.e., unassigned). In your copy of AI.cs, does line 927 look like this?
    Code (csharp):
    1.                     agent.speed = speedAmt;
     
  48. Deki3d-Virus

    Deki3d-Virus

    Joined:
    Dec 11, 2012
    Posts:
    23
    I dont have i have this in line 927
    float distance = Vector3.Distance(myTransform.position, target.position);


    i have agent.speed = speedAmt; in line 1109
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,867
    Above void Start(){, try adding this:
    Code (csharp):
    1. void Awake(){
    2.         myTransform = transform;
    3. }
     
  50. Deki3d-Virus

    Deki3d-Virus

    Joined:
    Dec 11, 2012
    Posts:
    23

    Not work same error
    in line 972 lastVisibleTargetPosition = target.position + (target.up * targetEyeHeight);