Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[RELEASED] Ultimate Survival - The Complete Survival Template

Discussion in 'Assets and Asset Store' started by AngryPixelUnity, Nov 20, 2016.

Thread Status:
Not open for further replies.
  1. KaVz

    KaVz

    Joined:
    Aug 14, 2016
    Posts:
    113
    Are you soure about those last words?
    http://store.steampowered.com/app/554900/
     
  2. Sickleadz

    Sickleadz

    Joined:
    Jan 24, 2014
    Posts:
    16
    I truly have no words for how amazing this kit is to work with... i look forward to see what people here come up with.. me myself is working on building elements.. i only imported a few of them into unity, as the others i am still working on them in 3dsmax, anyway... was pretty damn easy to set up using the doc.. Look forward for the further updates...

    Cheers all



     
  3. Sickleadz

    Sickleadz

    Joined:
    Jan 24, 2014
    Posts:
    16
  4. TheMessyCoder

    TheMessyCoder

    Joined:
    Feb 13, 2017
    Posts:
    503
  5. TheMessyCoder

    TheMessyCoder

    Joined:
    Feb 13, 2017
    Posts:
    503
    Guys, I have been sick most the weekend and thunderstorms have been cutting out my internet. So I have barely been able to do anything. Sorry about that.

    I have managed to quickly put together some tutorials on how to use UMA2 DCS and I will upload my script I wrote for integrating Ultimate Survival with UMA2 once I upload the tutorial.
     
    TacoPlayStudio likes this.
  6. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    497
    Thank you!
     
  7. TheMessyCoder

    TheMessyCoder

    Joined:
    Feb 13, 2017
    Posts:
    503


    Currently uploading the UMA2 tutorials, to show how to get the new UMA2 DCS (which will be released with UMA2.1)

    It is very easy to get UMA2 working in your game and you can be up and running in just a few minutes.
     
    Last edited: Mar 13, 2017
    AngryPixelUnity and wahyuway like this.
  8. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    497
    video not available
     
  9. TacoPlayStudio

    TacoPlayStudio

    Joined:
    Jan 12, 2013
    Posts:
    187
    I'm afraid the indie community will be harmed by these idiots. But I have faith in people like us. Who do the right thing.
     
    KaVz likes this.
  10. fahriabdillah

    fahriabdillah

    Joined:
    Jun 14, 2016
    Posts:
    5
    hello Winterbyte312, this is nice concept (the wild eight games)
    ScreenShot_20170313071457.png
     
  11. Will-D-Ramsey

    Will-D-Ramsey

    Joined:
    Dec 9, 2012
    Posts:
    221
    This kit is just to easy, shame to see people abusing using and putting it on steam barely changed. Woundnt take a noob long to make their first game with this. Either way love at first sight, cant wait for the updates.
     
    AngryPixelUnity likes this.
  12. ShatterGlassGames

    ShatterGlassGames

    Joined:
    Jan 14, 2016
    Posts:
    135
    How can I change the quantity of Planks or Sticks created by 1 log? I can't find it in the Item Database.
     
  13. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    Hi Kenny, you can't in 0.1 :( Will be possible in 0.2.
     
    TheMessyCoder and siblingrivalry like this.
  14. ShatterGlassGames

    ShatterGlassGames

    Joined:
    Jan 14, 2016
    Posts:
    135
    OK, I though I was just doing something wrong.

    Will wait.

    Also, I noticed that even if I change the hit sound effects for stone or metals, the sound uses the default rock hit sfx.
     
  15. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    You have to add the textures you're hitting in the Surface Database file, in the corresponding category.
    The surface database has to know which texture is a metal, which is wood, etc.
     
    TheMessyCoder and siblingrivalry like this.
  16. TheMessyCoder

    TheMessyCoder

    Joined:
    Feb 13, 2017
    Posts:
    503
    Hi,

    Quick link for adding clothes with UMA, the integration with US is coming next.
     
  17. UltraTM

    UltraTM

    Joined:
    Dec 8, 2013
    Posts:
    215
    UMA 2 is not so easy at all when it comes to multiplayer and syncing the Players.
    We used UMA 2 for our MMORPG.
    You need to invest a lot of work into it. To get the slots working syncing and so on.
    Also you finally need Armor pieces extra for UMA 2 since on the assetstore is only Fantasy Stuff and so.
    I hope with 2.1 the memory leak is also fixed. We went away from UMA cause of the performance finally.
    Also the Engine Atavism Online uses UMA 2. Where we used it also. But the memory leak was the problem and the devs invested so much time to get it integrated (switch armors, char creating with sliders and save it and and and. )

    It will be good amount of work if you want it integreted correct and smooth.
     
    AngryPixelUnity likes this.
  18. TheMessyCoder

    TheMessyCoder

    Joined:
    Feb 13, 2017
    Posts:
    503
    Ah thats great to know. Thanks. I will ask them over at the UMA group.
    How many UMAs did you have in your scene when you started to have issues?

    When you moved away from UMA, what did you use that gave better multiplayer performance?
    Thanks
     
  19. ShatterGlassGames

    ShatterGlassGames

    Joined:
    Jan 14, 2016
    Posts:
    135
    I did. And it still defaults to the original sound. My surface foorsteps changes but not the hit.
     
  20. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    UMA is really easy to integrate in a multiplayer game. I have done it several times and it just takes a few minutes to get the basics synced.

    Regarding the performance, i know several ppl using UMA for MMOs and i never heard of any memory issues. There is always the possibility of user error.
     
    wahyuway and Teila like this.
  21. TacoPlayStudio

    TacoPlayStudio

    Joined:
    Jan 12, 2013
    Posts:
    187
    @Winterbyte312
    Is it possible to use triangular objects on the foundations / ceilings in the building system?
     
    Last edited: Mar 14, 2017
  22. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,820
    Atavism uses a different version of UMA, which they modified for their purposes. We have not had problems with using many UMA's in a scene or getting it to run on our servers. I would be careful of comparing Atavism's version to UMA.
     
  23. ShatterGlassGames

    ShatterGlassGames

    Joined:
    Jan 14, 2016
    Posts:
    135
    Ok so I figured out. Try to follow me on this one.

    I had to change the "Chop" sound effect instead of the "Hit" sound effect in order to change the sound effect I get when i'm mining. Is it supposed to be like this? If that's the case i would recommend to change the name of chop to something like "Chop/Mine" Sound effect.
     
  24. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    The Axe has a "chop" sound type. The pickaxe has a "hit" sound type. But you're probably talking about the stone hatchet, which has 2 purposes (break rocks + chop trees). That's why it got a little confusing there, because the hatchet was seen as a chopping tool, it searched for chopping sounds. I'll look into how to simplify it further.
     
  25. ShatterGlassGames

    ShatterGlassGames

    Joined:
    Jan 14, 2016
    Posts:
    135
    Yeah it's for the stone hachet. The others work fine with the hit sfx :)
     
  26. Mattish

    Mattish

    Joined:
    Apr 13, 2013
    Posts:
    5
    @Winterbyte312 you have no idea how long i've been waiting for something like this, btw i think it would be a great idea to make a discord server, for people to join and talk about the project / help each other and show off stuff people have made :) ill be buying in the next couple of days!
     
    inoj and AngryPixelUnity like this.
  27. Hlo_man

    Hlo_man

    Joined:
    Jun 5, 2015
    Posts:
    67
    hi i need some help if there is any one who is good in blender and animating can you please help i have this problem where when i place the hands and the weapons and try to animate them, the hands just gets smaller and some what disappear and there offsets gets all F***ed up
     
  28. Hlo_man

    Hlo_man

    Joined:
    Jun 5, 2015
    Posts:
    67
    yah actually really cool idea :)
     
    inoj likes this.
  29. ShatterGlassGames

    ShatterGlassGames

    Joined:
    Jan 14, 2016
    Posts:
    135
    Sorry man but I'm sure this doesn't have anything to do with the US kit but instead a blender issue. You might want to create your own post asking for help on the problem you are having. Also, your video is offline.
     
  30. zombieslayer420

    zombieslayer420

    Joined:
    Dec 31, 2016
    Posts:
    31
    you should make it so you can disable the eat/drink cool down or change it
     
  31. zombieslayer420

    zombieslayer420

    Joined:
    Dec 31, 2016
    Posts:
    31
    the old asset called
    Survival Game Template got removed
     
  32. sebasfreelance

    sebasfreelance

    Joined:
    Aug 27, 2015
    Posts:
    227
    Hi Winterbyte, I have problems with doors, there are times when they open and sometimes they do not. I have not touched any prefab, does anyone else happen? thx

     
  33. inoj

    inoj

    Joined:
    Feb 27, 2014
    Posts:
    21
    Do we have any way so far or will there be coming a way to have player corpse, where items will stay for some time after player die? I've noticed that if i die i spawn with nothing on me and that makes it quite hard to get started again, could someone help me to get inventory controller items to be in inventory when player respawns? Another question is that i tried to integrate simple gui mainmenu and got it work somehow, but problem occurs when i go back to menu scene from my ingame pausemenu (from game scene) and then back to my game scene, it has gamecontroller and ingame gui objects dublicated (DontDestroyOnLoad), I've heard about having short scene before actual mainmenu scene where those objects loads and therefore it's impossible to load them 2nd time, im fairly beginner at coding and whole developing, if someone have an idea how i could do that kind of scene at beginning with this asset pack so i have possibility to go from ingame pause menu to mainmenu scene and back to ingame, i would appreciate help! Hope everyone is having great time with this great pack!
     
  34. Legend458

    Legend458

    Joined:
    Mar 13, 2016
    Posts:
    190
    Do you have any estimated time for tutorials on how to add buildable objects and animals?
     
  35. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    497
    another question please. regarding the particles that the bullet create when they hit something, there are spawned diferently according to the weapon shot, or it can be especific depending on the type of surface they hit
     
  36. TheMessyCoder

    TheMessyCoder

    Joined:
    Feb 13, 2017
    Posts:
    503
    Hi mate,

    Thanks for the support.
    I had planned for the weekend but I have been sick in bed for the last 4 days. So much for my plans.

    I have half of the video for adding storage done. But might delay it to work on animals instead.
     
    siblingrivalry likes this.
  37. siblingrivalry

    siblingrivalry

    Joined:
    Nov 25, 2014
    Posts:
    384
    Good riddance.
     
  38. KaVz

    KaVz

    Joined:
    Aug 14, 2016
    Posts:
    113
    @inoj
    I don't know about gui, but adding items after dying should be fairly easy. Find the method of giving items to inventory on start, copy it and paste on die() or something method. I can guide you on pw if you want.
     
    inoj likes this.
  39. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    I guess you opened the .blend file with the arms I sent. I remember the "auto record" was enabled by default, and so when you changed something (without realising), the change was recorded and screwed up everything. Blender is difficult to animate in for beginners, watch the first minutes of this:


    This is the "auto record" button:
    --> The red circle. You can see it is enabled.
    Make sure to disable it and insert your keyframes manually.
     
  40. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    Yep, that's one thing we didn't expand on in 0.1. Coming in 0.2, I'll write that down on Trello.
     
  41. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    I'll look into it for 0.2, thanks for the video, it helps to debug faster. If you have more info on how that happens, let me know.

    But for now, try to make the main collider of the door a little bigger. There are 2 colliders: Door's collider, and the "Hitbox", used for receiving damage.
    I'll get rid of hitboxes for buildables, only the ragdolls will have them. It's confusing and difficult to mantain.
     
  42. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    Yes, the items will be spawned on ground when you die, in 0.2.
    To have them in the inventory from now on, replace the InventoryController script with this:
    Code (CSharp):
    1. using System;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Random = UnityEngine.Random;
    5. using UltimateSurvival.GUISystem;
    6.  
    7. namespace UltimateSurvival
    8. {
    9.     /// <summary>
    10.     ///
    11.     /// </summary>
    12.     public class InventoryController : MonoSingleton<InventoryController>
    13.     {
    14.         /// <summary></summary>
    15.         public Value<ET.InventoryState> State = new Value<ET.InventoryState>(ET.InventoryState.Closed);
    16.  
    17.         /// <summary></summary>
    18.         public Attempt<ET.InventoryState> SetState = new Attempt<ET.InventoryState>();
    19.  
    20.         /// <summary></summary>
    21.         public Attempt<SmeltingStation> OpenFurnace = new Attempt<SmeltingStation>();
    22.  
    23.         /// <summary></summary>
    24.         public Attempt<SmeltingStation> OpenCampfire = new Attempt<SmeltingStation>();
    25.  
    26.         /// <summary></summary>
    27.         public Attempt<LootObject> OpenLootContainer = new Attempt<LootObject>();
    28.        
    29.         /// <summary></summary>
    30.         public Attempt<Anvil> OpenAnvil = new Attempt<Anvil>();
    31.  
    32.         /// <summary>This is an attempt to add a new item to the crafting queue.</summary>
    33.         public Attempt<CraftData> CraftItem = new Attempt<CraftData>();
    34.  
    35.         /// <summary></summary>
    36.         public Message<ItemHolder> EquipmentChanged = new Message<ItemHolder>();
    37.  
    38.         /// <summary>Is the inventory closed?</summary>
    39.         public bool IsClosed { get { return State.Is(ET.InventoryState.Closed); } }
    40.  
    41.         /// <summary>Stores all the item and recipe definitions.</summary>
    42.         public ItemDatabase Database { get { return m_ItemDatabase; } }
    43.  
    44.         [SerializeField]
    45.         [Tooltip("The inventory cannot function without this, as some operations, like ADD, LOAD require a database.")]
    46.         private ItemDatabase m_ItemDatabase;
    47.  
    48.         [SerializeField]
    49.         private bool m_RemoveItemsOnDeath;
    50.  
    51.         [Header("Item Collections")]
    52.  
    53.         [SerializeField]
    54.         [Range(1, 48)]
    55.         private int m_InventorySize = 24;
    56.  
    57.         [SerializeField]
    58.         [Range(1, 12)]
    59.         private int m_HotbarSize = 6;
    60.  
    61.         [SerializeField]
    62.         [Reorderable]
    63.         private ReorderableStringList m_EquipmentList;
    64.  
    65.         [Header("Item Drop")]
    66.  
    67.         [SerializeField]
    68.         private Vector3 m_DropOffset = new Vector3(0f, 0f, 0.8f);
    69.  
    70.         [SerializeField]
    71.         private float m_DropAngularFactor = 150f;
    72.  
    73.         [SerializeField]
    74.         private float m_DropSpeed = 8f;
    75.  
    76.         private PlayerEventHandler m_Player;
    77.         private ItemContainer[] m_AllCollections;
    78.         private float m_LastTimeToggledInventory;
    79.  
    80.         private List<ItemHolder> m_InventoryCollection;
    81.         private List<ItemHolder> m_HotbarCollection;
    82.         private List<ItemHolder> m_EquipmentHolders;
    83.  
    84.  
    85.         /// <summary>
    86.         /// Tries to add an amount of items in a certain collection.
    87.         /// </summary>
    88.         /// <param name="itemID"> The name of the item you want to add. </param>
    89.         /// <param name="amount"> How many items of this type you want to add?. </param>
    90.         /// <param name="collection"> Name the collection in which you want the item to be added, eg."Inventory". </param>
    91.         /// <param name="added"> This value represents the amount of items were added, if the collection was almost full, some of the items might've not been added. </param>
    92.         public bool AddItemToCollection(int itemID, int amount, string collection, out int added)
    93.         {
    94.             added = 0;
    95.  
    96.             if(!enabled)
    97.                 return false;
    98.            
    99.             for(int i = 0;i < m_AllCollections.Length;i ++)
    100.             {
    101.                 if(m_AllCollections[i].Name == collection)
    102.                 {
    103.                     // Will be true if at least one item was added.
    104.                     bool wasAdded = false;
    105.                     ItemData itemData;
    106.  
    107.                     if(m_ItemDatabase.FindItemById(itemID, out itemData))
    108.                         wasAdded = m_AllCollections[i].TryAddItem(itemData, amount, out added);
    109.  
    110.                     return wasAdded;
    111.                 }
    112.             }
    113.  
    114.             Debug.LogWarningFormat(this, "No collection with the name '{0}' was found! No item added.", collection);
    115.             return false;
    116.         }
    117.  
    118.         /// <summary>
    119.         /// Tries to add an amount of items in a certain collection.
    120.         /// </summary>
    121.         /// <param name="itemID">The id of the item you want to add.</param>
    122.         /// <param name="amount">How many items of this type you want to add?.</param>
    123.         /// <param name="collection">Name the collection in which you want the item to be added, eg."Inventory".</param>
    124.         /// <param name="added">This value represents the amount of items were added, if the collection was almost full, some of the items might've not been added.</param>
    125.         public bool AddItemToCollection(string itemName, int amount, string collection, out int added)
    126.         {
    127.             added = 0;
    128.  
    129.             if(!enabled)
    130.                 return false;
    131.  
    132.             for(int i = 0;i < m_AllCollections.Length;i ++)
    133.             {
    134.                 if(m_AllCollections[i].Name == collection)
    135.                 {
    136.                     // Will be true if at least one item was added.
    137.                     bool wasAdded = false;
    138.                     ItemData itemData;
    139.  
    140.                     if(m_ItemDatabase.FindItemByName(itemName, out itemData))
    141.                         wasAdded = m_AllCollections[i].TryAddItem(itemData, amount, out added);
    142.  
    143.                     return wasAdded;
    144.                 }
    145.             }
    146.  
    147.             Debug.LogWarningFormat(this, "No collection with the name '{0}' was found! No item added.", collection);
    148.             return false;
    149.         }
    150.  
    151.         public int GetItemCount(string name)
    152.         {
    153.             // TODO: We shouldn't have access to GUI functions here.
    154.             return GUIController.Instance.GetContainer("Inventory").GetItemCount(name);
    155.         }
    156.  
    157.         /// <summary>
    158.         /// Removes the item if it exists in the inventory, if not, the method will return false.
    159.         /// </summary>
    160.         public bool TryRemoveItem(SavableItem item)
    161.         {
    162.             if(!enabled)
    163.                 return false;
    164.            
    165.             for(int i = 0;i < m_AllCollections.Length;i ++)
    166.             {
    167.                 bool removed = m_AllCollections[i].TryRemoveItem(item);
    168.                 if(removed)
    169.                     return true;
    170.             }
    171.  
    172.             return false;
    173.         }
    174.  
    175.         public void RemoveItems(string itemName, int amount = 1)
    176.         {
    177.             // TODO: We shouldn't have access to GUI functions here.
    178.             var inventory = GUIController.Instance.GetContainer("Inventory");
    179.             inventory.RemoveItems(itemName, amount);
    180.         }
    181.  
    182.         public bool Try_DropItem(SavableItem item, Slot parentSlot = null)
    183.         {
    184.             if(item && item.ItemData.WorldObject && !item.ItemData.IsBuildable)
    185.             {
    186.                 var cameraTransform = GameController.WorldCamera.transform;
    187.                 GameObject droppedItem = Instantiate(item.ItemData.WorldObject, cameraTransform.position + cameraTransform.TransformVector(m_DropOffset), Random.rotation) as GameObject;
    188.  
    189.                 var rigidbody = droppedItem.GetComponent<Rigidbody>();
    190.                 if(rigidbody)
    191.                 {
    192.                     rigidbody.angularVelocity = Random.rotation.eulerAngles * m_DropAngularFactor;
    193.                     rigidbody.AddForce(cameraTransform.forward * m_DropSpeed, ForceMode.VelocityChange);
    194.  
    195.                     Physics.IgnoreCollision(m_Player.GetComponent<Collider>(), droppedItem.GetComponent<Collider>());
    196.                 }
    197.  
    198.                 var pickup = droppedItem.GetComponent<ItemPickup>();
    199.                 if(pickup)
    200.                     pickup.ItemToAdd = item;
    201.  
    202.                 if(parentSlot)
    203.                     parentSlot.ItemHolder.SetItem(null);
    204.  
    205.                 return true;
    206.             }
    207.  
    208.             return false;
    209.         }
    210.  
    211.         public List<ItemHolder> GetEquipmentHolders()
    212.         {
    213.             return m_EquipmentHolders;
    214.         }
    215.  
    216.         private void Awake()
    217.         {
    218.             if(!m_ItemDatabase)
    219.             {
    220.                 Debug.LogError("No ItemDatabase specified, the inventory will be disabled!", this);
    221.                 enabled = false;
    222.                 return;
    223.             }
    224.  
    225.             SetState.SetTryer(TryChange_State);
    226.  
    227.             // TODO: We shouldn't have access to GUI functions here.
    228.             m_AllCollections = GUIController.Instance.Containers;
    229.  
    230.             // Create the inventory.
    231.             // TODO: We shouldn't have access to GUI functions here.
    232.             m_InventoryCollection = CreateListOfHolders(m_InventorySize);
    233.             var inventoryCollection = GUIController.Instance.GetContainer("Inventory");
    234.             inventoryCollection.Setup(m_InventoryCollection);
    235.  
    236.             // Create the hotbar.
    237.             // TODO: We shouldn't have access to GUI functions here.
    238.             m_HotbarCollection = CreateListOfHolders(m_HotbarSize);
    239.             var hotbarCollection = GUIController.Instance.GetContainer("Hotbar");
    240.             hotbarCollection.Setup(m_HotbarCollection);
    241.  
    242.             // Create the equipment.
    243.             // TODO: We shouldn't have access to GUI functions here.
    244.             m_EquipmentHolders = CreateListOfHolders(m_EquipmentList.Count);
    245.             for(int i = 0;i < m_EquipmentList.Count;i ++)
    246.             {
    247.                 var equipmentGUI = GUIController.Instance.GetContainer(m_EquipmentList[i]);
    248.                 if(equipmentGUI)
    249.                     equipmentGUI.Setup(new List<ItemHolder>() { m_EquipmentHolders[i] });
    250.                 else
    251.                     Debug.LogErrorFormat(this, "No GUI collection with the name '{0}' was found!", m_EquipmentList[i]);
    252.             }
    253.  
    254.             m_Player = GameController.LocalPlayer;
    255.             m_Player.ChangeHealth.AddListener(OnChanged_PlayerHealth);
    256.             m_Player.Death.AddListener(On_PlayerDeath);
    257.         }
    258.  
    259.         private void OnChanged_PlayerHealth(HealthEventData data)
    260.         {
    261.             if(data.Delta < 0f)
    262.                 for(int i = 0; i < m_EquipmentHolders.Count; i ++)
    263.                 {
    264.                     if(m_EquipmentHolders[i].HasItem && m_EquipmentHolders[i].CurrentItem.HasProperty("Durability"))
    265.                     {
    266.                         var durabilityProp = m_EquipmentHolders[i].CurrentItem.GetPropertyValue("Durability");
    267.                         var floatVal = durabilityProp.Float;
    268.                         floatVal.Current --;
    269.  
    270.                         durabilityProp.SetValue(ItemProperty.Type.Float, floatVal);
    271.  
    272.                         if(floatVal.Current <= 0f)
    273.                             m_EquipmentHolders[i].SetItem(null);
    274.                     }
    275.                 }
    276.         }
    277.  
    278.         private void On_PlayerDeath()
    279.         {
    280.             if(State.Get() != ET.InventoryState.Closed)
    281.                 SetState.Try(ET.InventoryState.Closed);
    282.  
    283.             if(m_RemoveItemsOnDeath)
    284.             {
    285.                 RemoveItemsFromCollection("Inventory");
    286.                 RemoveItemsFromCollection("Hotbar");
    287.  
    288.                 foreach(var col in m_EquipmentList)
    289.                     RemoveItemsFromCollection(col);
    290.             }
    291.         }
    292.  
    293.         private void RemoveItemsFromCollection(string collection)
    294.         {
    295.             // TODO: We shouldn't have access to GUI functions here.
    296.             var wrapper = GUIController.Instance.GetContainer(collection);
    297.  
    298.             if(!wrapper)
    299.                 return;
    300.  
    301.             foreach(var slot in wrapper.Slots)
    302.             {
    303.                 if(slot.HasItem)
    304.                     slot.ItemHolder.SetItem(null);
    305.             }
    306.         }
    307.  
    308.         private void DropItemsFromCollection(string collection)
    309.         {
    310.             var container = GUIController.Instance.GetContainer(collection);
    311.  
    312.             if(!container)
    313.                 return;
    314.  
    315.             foreach(var slot in container.Slots)
    316.             {
    317.                 if(slot.HasItem)
    318.                 {
    319.                     if(slot.CurrentItem.ItemData.IsBuildable)
    320.                         slot.ItemHolder.SetItem(null);
    321.                     else
    322.                         Try_DropItem(slot.CurrentItem, slot);
    323.                 }
    324.             }
    325.         }
    326.  
    327.         private bool TryChange_State(ET.InventoryState state)
    328.         {
    329.             bool stateWasChanged = false;
    330.  
    331.             if(Time.time > m_LastTimeToggledInventory + 0.5f)
    332.             {
    333.                 m_LastTimeToggledInventory = Time.time;
    334.                 stateWasChanged = true;
    335.             }
    336.                
    337.             if(stateWasChanged)
    338.             {
    339.                 State.Set(state);
    340.                 UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(null);
    341.             }
    342.  
    343.             return stateWasChanged;
    344.         }
    345.  
    346.         private List<ItemHolder> CreateListOfHolders(int size)
    347.         {
    348.             var slots = new List<ItemHolder>();
    349.  
    350.             for(int i = 0;i < size;i ++)
    351.                 slots.Add(new ItemHolder());
    352.  
    353.             return slots;
    354.         }
    355.     }
    356. }
    357.  
    To have the In-Game GUI and Game Controller duplicates destroyed on scene-load:

    #1. Replace the GUIController script with this:
    Code (CSharp):
    1. using System;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5.  
    6. namespace UltimateSurvival.GUISystem
    7. {
    8.     public class GUIController : MonoBehaviour
    9.     {
    10.         public static GUIController Instance { get; private set; }
    11.  
    12.  
    13.         public PlayerEventHandler Player { get; private set; }
    14.  
    15.         /// <summary>The main Canvas that's used for the GUI elements.</summary>
    16.         public Canvas Canvas { get { return m_Canvas; } }
    17.  
    18.         /// <summary>All the item collections that are part of the GUI.</summary>
    19.         public ItemContainer[] Containers { get; private set; }
    20.  
    21.         public Font Font { get { return m_Font; } }
    22.  
    23.         [Header("Setup")]
    24.  
    25.         [SerializeField]
    26.         private Canvas m_Canvas;
    27.  
    28.         [SerializeField]
    29.         private Camera m_GUICamera;
    30.  
    31.         [SerializeField]
    32.         private Font m_Font;
    33.  
    34.         [SerializeField]
    35.         [Reorderable]
    36.         [Tooltip("If the player clicks while on those rects, the current selection will not be lost.")]
    37.         private ReorderableRectTransformList m_SelectionBlockers;
    38.  
    39.         [Header("Audio")]
    40.  
    41.         [SerializeField]
    42.         private AudioClip m_InventoryOpenClip;
    43.  
    44.         [SerializeField]
    45.         private AudioClip m_InventoryCloseClip;
    46.  
    47.  
    48.         public ItemContainer GetContainer(string name)
    49.         {
    50.             for(int i = 0;i < Containers.Length;i ++)
    51.                 if(Containers[i].Name == name)
    52.                     return Containers[i];
    53.  
    54.             Debug.LogWarning("No container with the name " + name + " found!");
    55.  
    56.             return null;
    57.         }
    58.  
    59.         public bool MouseOverSelectionKeeper()
    60.         {
    61.             for (int i = 0; i < m_SelectionBlockers.Count; i++)
    62.             {
    63.                 if(!m_SelectionBlockers[i].gameObject.activeSelf)
    64.                     continue;
    65.                
    66.                 bool containsPoint = RectTransformUtility.RectangleContainsScreenPoint(m_SelectionBlockers[i], Input.mousePosition, m_GUICamera);
    67.                 if(containsPoint)
    68.                     return true;
    69.             }
    70.  
    71.             return false;
    72.         }
    73.  
    74.         public void ApplyForAllCollections()
    75.         {
    76.             foreach(var collection in GetComponentsInChildren<ItemContainer>(true))
    77.                 collection.ApplyAll();
    78.         }
    79.  
    80.         private void Awake()
    81.         {
    82.             if(Instance == null)
    83.             {
    84.                 Instance = this;
    85.                 DontDestroyOnLoad(gameObject);
    86.             }
    87.             else if(Instance != this)
    88.             {
    89.                 Destroy(gameObject);
    90.                 return;
    91.             }
    92.  
    93.             Containers = GetComponentsInChildren<ItemContainer>(true);
    94.             Player = GameController.LocalPlayer;
    95.         }
    96.  
    97.         private void Start()
    98.         {
    99.             InventoryController.Instance.State.AddChangeListener(OnChanged_InventoryState);
    100.         }
    101.  
    102.         private void OnChanged_InventoryState()
    103.         {
    104.             if(!InventoryController.Instance.IsClosed)
    105.                 GameController.Audio.Play2D(m_InventoryOpenClip, 0.6f);
    106.             else
    107.                 GameController.Audio.Play2D(m_InventoryCloseClip, 0.6f);
    108.         }
    109.     }
    110. }
    111.  
    #2. Replace the GameController script with this:
    Code (CSharp):
    1. using System.Collections;
    2. using UnityEngine;
    3. using UltimateSurvival.InputSystem;
    4.  
    5. namespace UltimateSurvival
    6. {
    7.     /// <summary>
    8.     /// The game's central control point.
    9.     /// </summary>
    10.     public class GameController : MonoBehaviour
    11.     {
    12.         public static GameController Instance { get; private set; }
    13.  
    14.         /// <summary> </summary>
    15.         public static PlayerEventHandler LocalPlayer
    16.         {
    17.             get
    18.             {
    19.                 if(m_Player == null)
    20.                     m_Player = FindObjectOfType<PlayerEventHandler>();
    21.                 return m_Player;
    22.             }
    23.         }
    24.  
    25.         /// <summary> </summary>
    26.         public static InputManager InputManager
    27.         {
    28.             get
    29.             {
    30.                 if(m_InputManager == null)
    31.                     m_InputManager = FindObjectOfType<InputManager>();
    32.                 return m_InputManager;
    33.             }
    34.         }
    35.  
    36.         /// <summary></summary>
    37.         public static float NormalizedTime { get; set; }
    38.  
    39.         /// <summary></summary>
    40.         public static AudioUtils Audio { get; private set; }
    41.  
    42.         /// <summary></summary>
    43.         public static Camera WorldCamera { get; private set; }
    44.  
    45.         /// <summary></summary>
    46.         public static SurfaceDatabase SurfaceDatabase { get; private set; }
    47.  
    48.         /// <summary></summary>
    49.         public static ItemDatabase ItemDatabase { get; private set; }
    50.  
    51.         public static TreeManager TerrainHelpers { get; private set; }
    52.  
    53.         [SerializeField]
    54.         private SurfaceDatabase m_SurfaceDatabase;
    55.  
    56.         [SerializeField]
    57.         private ItemDatabase m_ItemDatabase;
    58.  
    59.         private static InputManager m_InputManager;
    60.         private static PlayerEventHandler m_Player;
    61.  
    62.  
    63.         private void Awake()
    64.         {
    65.             if(Instance == null)
    66.             {
    67.                 Instance = this;
    68.                 DontDestroyOnLoad(gameObject);
    69.             }
    70.             else if(Instance != this)
    71.             {
    72.                 Destroy(gameObject);
    73.                 return;
    74.             }
    75.  
    76.             Audio = GetComponentInChildren<AudioUtils>();
    77.  
    78.             WorldCamera = LocalPlayer.transform.FindDeepChild("World Camera").GetComponent<Camera>();
    79.  
    80.             SurfaceDatabase = m_SurfaceDatabase;
    81.             ItemDatabase = m_ItemDatabase;
    82.  
    83.             TerrainHelpers = GetComponent<TreeManager>();
    84.  
    85.             DontDestroyOnLoad(gameObject);
    86.         }
    87.     }
    88. }
    89.  
     
  43. sebasfreelance

    sebasfreelance

    Joined:
    Aug 27, 2015
    Posts:
    227
    Thx, I do not do anything strange, I have to try if it happens to me in the demo scene of the asset. I'll try what you say.

    a greeting.
     
  44. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    They are spawned based on the texture/surface. You can tweak surfaces and their textures, in the "Surface Database" file, located in the Resources folder.
     
  45. TacoPlayStudio

    TacoPlayStudio

    Joined:
    Jan 12, 2013
    Posts:
    187
    I lost money with this one. It is good news that there is no more.
     
    ShatterGlassGames likes this.
  46. ShatterGlassGames

    ShatterGlassGames

    Joined:
    Jan 14, 2016
    Posts:
    135
    It took Unity a really long time to remove this bad asset pack. I bet Unity was just waiting for another Survival Game Template was released to finally remove it..
     
    TacoPlayStudio likes this.
  47. ShatterGlassGames

    ShatterGlassGames

    Joined:
    Jan 14, 2016
    Posts:
    135
    I came across a strange bug that causes my character to not Run even if my stamina is full. I believe it happens when returning from a weapon Zoom/Aim. Again it's a some what of a rare bug.
     
  48. Mattish

    Mattish

    Joined:
    Apr 13, 2013
    Posts:
    5
    this is why a discord is good for people to log bugs and keep up to date, forums get kinda jumbled :p *hints for discord* haha
     
  49. bobbybau

    bobbybau

    Joined:
    Feb 28, 2017
    Posts:
    33
    Question, when you say multiplayer function will this be like a co op invite multiplayer function or would this be like i could host this on a server and invite players to the server like an MMORPG
     
  50. inoj

    inoj

    Joined:
    Feb 27, 2014
    Posts:
    21
    Thank you so much sir @Winterbyte312 & @KaVz ! I will try these scripts out in a bit, hope it will work.

    EDIT: Respawning script seems to be working perfectly! I still encounter some errors when i hit back to mainmenu button in game and try to load another scene from gameplay scene.



    here is picture of what i get as soon as i press that menu button, atleast i've got mainmenu on startup to work and you can enter to game once, also pause menu work fine! Thank you for everybody who has been trying to help me with my beginner problems.

    And if it does help anything, it's this pack from asset store I've been trying to integrate with my game https://www.assetstore.unity3d.com/en/#!/content/71893
     
    Last edited: Mar 14, 2017
Thread Status:
Not open for further replies.
unityunity