1. Post #2721
    My eyes bleed everytime you fail to make your functions local
    wh1t3rabbit's Avatar
    January 2012
    1,089 Posts
    Anyone know how to get the on screen keyboard to pop up when focusing text fields when running as a UWP app on Xbox One?

  2. Post #2722
    Fourier's Avatar
    July 2014
    3,966 Posts
    I wasn't aware that you worked on Floatlands, Fourier.
    I've seen the blog posts for it every now and again, it's lookin neat.
    Likewise, I didnt realise you were working on this, thats awesome!

    Thanks you two! Yeah, I & my team are working on it for ~1 year already :).

  3. Post #2723
    keeperman's Avatar
    October 2015
    203 Posts
    Is it possible to get a multidimentional array/list in unityscript to show in the inspector without having to make a custom editor?

  4. Post #2724
    Gold Member
    Janooba's Avatar
    February 2008
    1,588 Posts
    Is it possible to get a multidimentional array/list in unityscript to show in the inspector without having to make a custom editor?
    Outside of creating a custom editor, the only other way I can find is to create an array of a class that contains an array.

    Code:
    // Assume you wanted a two dimensional array of ints
    [System.Serializable]
    public class NumArray
    {
        [SerializeField] public int[] num;
    }
    Then, in your monobehaviour you just put:

    Code:
    public NumArray[] numArray;
    You can parse through it like so:
    Code:
    for (int x = 0; x < numArray.Length; x++)
        for (int y = 0; y < numArray[x].num.Length; y++)
        {
            var data = numArray[x].num[y];
        }
    It's a little un-intuitive, but such is life in Unity.
    Reply With Quote Edit / Delete Reply Windows 10 Firefox Canada Show Events Useful Useful x 1Programming King Programming King x 1 (list)

  5. Post #2725
    Gold Member
    Richy19's Avatar
    May 2010
    5,745 Posts
    Anyone know why I may be seeing these weird shadow artifactes around the edges?




  6. Post #2726
    Anyone know why I may be seeing these weird shadow artifactes around the edges?



    Did you accidentally mouse wheel over the game window? Game window can zoom in and out.

  7. Post #2727
    Gold Member
    Richy19's Avatar
    May 2010
    5,745 Posts
    Did you accidentally mouse wheel over the game window? Game window can zoom in and out.
    In the second image? Yea I zoomed in to show the issue better

    To clarify, the issue in talking about is happening in the corners of the cubes, where the shadow makes them look like they are slightly lifted from what ever is below then

  8. Post #2728
    Limed00d's bottom bitch
    Jodern's Avatar
    March 2012
    804 Posts
    Anyone know why I may be seeing these weird shadow artifactes around the edges?




    You could try toying with the shadow bias settings on the light.
    It might also partially down to shadow resolution in quality settings.
    Reply With Quote Edit / Delete Reply Windows 10 Firefox Norway Show Events Agree Agree x 3 (list)

  9. Post #2729
    Oh I see, not sure.


    Anyone playing with Unity Tilemap stuff in Beta? I can't figure out why a custom tile asset doesn't show public variables I add or show serializedfield.



    Fixed. Seems unity only will show a variable that is a class if it inherits from Monobehaviour.

  10. Post #2730
    secundus's Avatar
    December 2009
    1,044 Posts
    To show non-Monobehaviour class in inspector the class needs [System.Serializable].

    Also [SerializeField] don't work on properties (unless things have changed in 2017.1).

  11. Post #2731
    Yeah, I learned Unity new Tilemap system makes all Tiles the same no matter what coordinate it's at. Which makes sense rendering wise but when I want to have a custom tile that has a variable like how Wet the tile is. If I say "This grass tile is really wet." Unity says, "ALL GRASS TILES ARE REALLY WET".

    6 hours for me to figure this out. I don't know why I didn't see this early.

    But I redid my code and now it's pure coordinate based floodfill room detection.

    Not sure how to do tag mp4...

    http://a.uguu.se/CvOQBflquiEY_2017-08-02_23-35-18.mp4

  12. Post #2732
    awcmon's Avatar
    September 2010
    561 Posts
    I keep getting some massive fucking lag spike. I looked in profiler and there was this "UpdateScreenManagerAndInput" thing that was the sole reason behind the spike. It drops me from 100+ fps down to 20-30 and disturbs me a lot.

    It's present in all my projects, even empty ones.

    I googled it and it seems some people have had this issue before (for about a year) but Unity hasn't seemed to fix this yet. I'm on 5.6.1. Has anybody here seen this issue before and found a fix?
    I downloaded Unity 2017.1 and I'm still getting the same error on a fresh project. I uninstalled and reinstalled again. It's still there.



    Empty scene, massive fucking FPS drop every second or so. Noticeable in a game and I still get it when I build it. I've given builds to friends and I don't think they have the same problem though. I'm running on Windows 10 and I disabled game mode and the xbox DVR thing and game bar and all that crap and problem's still there.

  13. Post #2733
    So after a full day of errors I finally got 8-bit Auto-Tiling working with Unity's new Tilemap/Custom tiles.

    Uses a dictionary to look up what sprite it should be. Only issue is tiles have to be placed in a certain order for easy "drag and drop" for the sprite array. Other wise...well..good luck naming and setting.

    in action: https://a.uguu.se/46kOzUvur77r_2017-08-05_15-33-49.mp4

    Grab it from my github to try.

  14. Post #2734
    Phobos001's Avatar
    November 2009
    252 Posts
    Made a game in Unity for Ludum Dare 39. It's pretty different from my normal work but it seems to be fairing well

    https://ldjam.com/events/ludum-dare/39/while-true-do

    Video (Will vanish in like a month):

    Reply With Quote Edit / Delete Reply Linux Chrome United States Show Events Winner Winner x 1 (list)

  15. Post #2735

    September 2016
    10 Posts
    Aaaahhh I really like to read about C# with Unity and without Unity ( OpenTK 2.0 / 3.0 Pre )

    I already read that. Right you mean about work in process or development with Unity or OpentK 2.0 / 3.0 Pre.

    I want listen about features of AI, Monster movements and more into OpenTK 2.0 / 3.0 pre because I am developing as game Half-Life port to C#. Because I want they are unity developers and they are happy with Half-Life Sharp if they write easy and you have mega ideas for example initial fog, entity was written from C#.

    Sorry for my bad English! :)
    Reply With Quote Edit / Delete Reply Windows 10 Chrome Germany Show Events Informative Informative x 2 (list)

  16. Post #2736
    Gold Member
    Clavus's Avatar
    September 2009
    8,520 Posts
    This is new.



    About every dozen seconds my Unity instance freezes for a solid 5 seconds. Tried profiling the editor but only shows 'unaccounted time'.

    Problem persists between projects. Interval between freezes gets worse over time when having a project open. Often triggered by dragging windows 'n shit. Tried updating Unity from 5.6.1 to 5.6.3 and then 2017.1, problem kept persisting. Tried completely reinstalling, nothing changed. My best guess is, since the profiler mentions an "Usb.OnDeviceChanged" event, that it has to do with hardware I have connected?

    Don't really know where to go from here :/

    Edited:

    Appears the Oculus software update this week is the culprit. Stop the OVRService process to fix for now.

  17. Post #2737
    Gold Member
    Pelf's Avatar
    September 2007
    3,400 Posts
    Unity is officially depreciating Unityscript/Javascript: https://blogs.unity3d.com/2017/08/11...to-the-sunset/
    Reply With Quote Edit / Delete Reply Windows 8.1 Chrome United States Show Events Winner Winner x 10 (list)

  18. Post #2738
    Gold Member
    war_man333's Avatar
    May 2006
    7,775 Posts
    remember to use booleans guys
    Reply With Quote Edit / Delete Reply Windows 10 Firefox Finland Show Events Funny Funny x 5Artistic Artistic x 2Informative Informative x 1 (list)

  19. Post #2739
    MilkBiscuit's Avatar
    May 2014
    392 Posts
    The Playables API Unity introduced in 2017.1 is powerful as all hell. The documentation is absolute garbage, but once you piece together how it's structured it really makes you wonder why this isn't what we got with the release of Mecanim. Definitely play around with it when you get the chance.

  20. Post #2740
    Gold Member
    Why485's Avatar
    February 2010
    5,624 Posts
    I finally released that missile thing that I've been sitting on for like a year or so. It's a code and effects pack, along with sample prefabs and documentation, for creating simple Ace Combat style arcade missile.



    The itch page, along with a downloadable playable demo is here. The itch page has links to the asset pack itself, as well as the github page.

    Features include:
    Code:
    - Two kinds of guidance: Pure pursuit and Lead
    - Support for both Update and FixedUpdate based projects
    - Many tweakable missile parameters such as seeker cone, motor acceleration, and turn rate
    - Missiles can be set with a delayed activation to allow dropping before firing
    - Effects manager that handles both ribbon trails and particle system trails, as well as explosions
    - Spawned effects (trails and explosions) automatically clean themselves up
    - Audio is handled automatically when assigned an audio clip with adjustable parameters
    - Detailed documentation for reference
    - Two types of missile launchers: Pod and Hardpoint
    - Hardpoints can carry missiles externally, while pods launch from user defined tubes with reloadable magazines
    - Pack includes example effects for particle and ribbon trails, basic sound effects, and explosions
    I keep meaning to make a nice video to upload for Youtube but I haven't gotten around to it yet.
    Reply With Quote Edit / Delete Reply Windows 10 Chrome United States Show Events Winner Winner x 2 (list)

  21. Post #2741
    Limed00d's bottom bitch
    Jodern's Avatar
    March 2012
    804 Posts
    I absolutely love how it is 10 times faster to google Unity api than actually serarch in the documentation
    Reply With Quote Edit / Delete Reply Windows 10 Firefox Norway Show Events Agree Agree x 5Funny Funny x 1 (list)

  22. Post #2742
    Gold Member
    AJ10017's Avatar
    June 2012
    2,265 Posts
    been working on this off and on for the last week, another project to add the to unfinished pile. i did finally figure out after 2 hours how Vector3.Dot works though

    really love the improvements to how particle systems work in this version of unity though, can make so many cool looking effects with it
    Reply With Quote Edit / Delete Reply Windows 10 Firefox Show Events Artistic Artistic x 1 (list)

  23. Post #2743
    Gold Member
    Jalict's Avatar
    August 2007
    1,622 Posts
    So I am working on this little stupid project right now that quickly got stopped.

    How would one go about load .fbx, .obj, .png, .jpg, etc. at Runtime? After reading up I understand that the AssetBundle is the files being "converted" into Unity Format. So I should somehow tell the Assetbundle to load this-and-that file and pack it into a "bundle". But how would I go on about that?

    The documentation and Googling have been a bit confusing for me. So if someone could help me a bit on just how to load shit at runtime then I would be extremely happy.

    I have found several Unity Assets Projects which have this function. But it seems like they build their own model/imageloader together with creating the meshes/textures from bottom up. Is that really the approach? Why can't I just access whatever the Unity Editor is doing?

  24. Post #2744
    Gold Member
    gonzalolog's Avatar
    April 2011
    3,666 Posts
    Because unity engine is more complex than that, unity has processors inside the editor assemblies, that are not accessible from the game itself, that's the problem with runtime processors

  25. Post #2745
    crazymonkay's Avatar
    January 2009
    1,034 Posts
    So I am working on this little stupid project right now that quickly got stopped.

    How would one go about load .fbx, .obj, .png, .jpg, etc. at Runtime? After reading up I understand that the AssetBundle is the files being "converted" into Unity Format. So I should somehow tell the Assetbundle to load this-and-that file and pack it into a "bundle". But how would I go on about that?

    The documentation and Googling have been a bit confusing for me. So if someone could help me a bit on just how to load shit at runtime then I would be extremely happy.

    I have found several Unity Assets Projects which have this function. But it seems like they build their own model/imageloader together with creating the meshes/textures from bottom up. Is that really the approach? Why can't I just access whatever the Unity Editor is doing?
    Asset Bundles are not really meant for custom content loaded off of the file system, if I am understanding what you're wanting to do correctly. They're bundles of built-in content that can be used for things like DLC, loading specific assets only when needed, stuff like that. There are a lot of Unity Editor functions that cannot be used at runtime (specifcally, everything in the UnityEditor namespace), so unfortunately it is not possible to just do what the editor does.

    I have some things here for loading textures and models off the file system, maybe they'll be useful:

    Loading a texture from a file is pretty simple and here's a function to do it. I haven't tested it on all image formats but it at least works with .png and .jpg:
    Code:
        /// <summary>
        /// Attempts to load the image at the given path and convert it to a Texture2D.
        /// </summary>
        public static Texture2D LoadTextureFromFile(string path)
        {
            if (path == null || path == "")
                return null;
    
            string fullPath = path;
            Texture2D tex = new Texture2D(2, 2);
    
            try
            {
                using (System.IO.FileStream stream = File.Open(fullPath, FileMode.Open))
                {
                    byte[] bytes = new byte[stream.Length];
    
                    for (int i = 0; i < bytes.Length; i++)
                        bytes[i] = (byte)stream.ReadByte();
    
                    tex.LoadImage(bytes);
                    return tex;
                }
            }
            catch (FileNotFoundException e)
            {
                Debug.Log("Texture not found at path: " + fullPath);
                return null;
            }
            catch (Exception e)
            {
                Debug.LogError(e.GetType().FullName + " - Failed to load texture from path: " + fullPath);
                Debug.LogException(e);
                return null;
            }
        }
    Loading models is not as simple. I've only ever tried importing .obj files since they have a fairly simple file structure. Here is a script I wrote a while back that can create meshes from an .obj file:https://pastebin.com/GyEdhUfu

    So yeah, if you want to import things at runtime you will have to write an importer yourself or purchase something from the Asset Store.
    Reply With Quote Edit / Delete Reply Windows 10 Chrome United States Show Events Informative Informative x 1 (list)

  26. Post #2746
    Gold Member
    foszor's Avatar
    April 2005
    1,035 Posts
    Couldn't you use Resources.Load ?

  27. Post #2747
    crazymonkay's Avatar
    January 2009
    1,034 Posts
    Couldn't you use Resources.Load ?
    Yeah, from what I've seen the Resources system and Asset Bundles are pretty similar in how you access assets from your code, but many people seem to advise not using Resources. Even Unity's Official Tutorials strongly discourage using Resources over AssetBundles except for a couple cases.

    In my current project I heavily rely on the Resources system, but I really need to try switching to AssetBundles whenever I get the chance.

  28. Post #2748
    Gold Member
    Drury's Avatar
    April 2011
    12,933 Posts
    just when I thought the updater ran out of ways to prank me, it tells me 2017.1.1 is out, completely arbitrarily and 10 days late, and literally a few moments later, it goes "nvm 2017.1.0 is latest ur good"

    did they code into it the cursed spirit of a disgruntled soviet worker or what

  29. Post #2749
    Gold Member
    gonzalolog's Avatar
    April 2011
    3,666 Posts
    Unity NEVER notified me about an update, even on betas, i have to manually and check versions since "ur in latest, ur good"

  30. Post #2750
    keeperman's Avatar
    October 2015
    203 Posts
    I'm one test away from pulling out my hair. I've got this script that should allow you too pick up custom class objects and put them into a list and it works. But for some dumb reason the for loop doesn't always work so it gets the first object then the second but if you add the first again it creates a new one for no reason.
    TL;DR my loop doesn't get to finish
    Code:
    import System.Linq;
    
    var InventoryScript : Inventory;
    
    var ThisAmmo : AmmoClass = new AmmoClass();
    
    function OnMouseOver () {
    	if (Input.GetKeyUp(KeyCode.E)) {
    		//ThisAmmo.Amount = Random.Range(2, 10 * InventoryScript.Level);
    		if (InventoryScript.AmmoList.Count == 0) { // if list is empty then just add it
    			InventoryScript.AmmoList.Add(ThisAmmo);
    		} else {
    			for (var i : int = 0; i < InventoryScript.AmmoList.Count; i++) {;
    				if (InventoryScript.AmmoList[i].Name == ThisAmmo.Name) {
    					print("sak finns");
    					print(InventoryScript.AmmoList[i]);
    					InventoryScript.AmmoList[i].Amount += Random.Range(2, 10 * InventoryScript.Level);
    				}
    				if (i == InventoryScript.AmmoList.Count - 1 &&  InventoryScript.AmmoList[i].Name != ThisAmmo.Name) { // i know i could use else but i tried everything i can think of
    					print("sak finns ej");
    					InventoryScript.AmmoList.Add(ThisAmmo);
    				}
    			}
    		}
    		//Destroy(this.gameObject);
    	}
    }

  31. Post #2751
    secundus's Avatar
    December 2009
    1,044 Posts
    So when you picked up an ammo, you check the inventory if it has any ammo at all, if not then add the ammo in.
    If the inventory had any type of ammo, you checked every single one of them if its the same type of the one being picked up, and if it is, you add the amount, otherwise, after checking the last ammo whether its the same type, you checked again if its the same and if it is really not, you add the ammo in.

    Is Name a string, or is it a class or struct? If its not a string, then comparing with == might not work because its not the same object instance.

  32. Post #2752
    Gold Member
    gonzalolog's Avatar
    April 2011
    3,666 Posts
    I have a question, what's your best way to create an item system, i've developed an inventory editor that creates scriptable objects with all definitions inside, but i have no idea how can i give them custom behaviors like custom consumables or actions when equipped

  33. Post #2753
    A six sided fish cube of the Flounder variety
    TheGoodDoctorF's Avatar
    March 2010
    4,116 Posts
    I have a question, what's your best way to create an item system, i've developed an inventory editor that creates scriptable objects with all definitions inside, but i have no idea how can i give them custom behaviors like custom consumables or actions when equipped
    My suggestion would be to create a base class that contains a UseItem() function or something. Then create child classes for each type of item (consumable, action, weapon, ect) and pass parameters. When the player selects an item, UseItem get's called and runs the special behavior. Dunno if that's what you're looking for.

  34. Post #2754
    secundus's Avatar
    December 2009
    1,044 Posts
    How bad will this blow up in my face? Intent is to have a UIManager singleton (eww, I know) accessed by calling UIManager.current.

    Code:
    BaseUI[] uiPanels;
    Dictionary<System.Type, BaseUI>() uiDict;
    
    public void Initialize()
    {
    	// uiPanels set in Inspector
    	uiDict = new Dictionary<System.Type, BaseUI>();
    	foreach(BaseUI ui in uiPanels)
    	{
    		ui.Initialize();
    		uiDict.Add(ui.GetType(), ui);
    	}
    }
    
    public T GetUI<T>() where T : BaseUI
    {
    	BaseUI def;
    	if(uiDict.TryGetValue(typeof(T), out def))
    		return def;
    
    	return null;
    }
    Usage:
    Code:
    void Awake()
    {
    	ItemButton item = Instantiate(itemButtonPrefab, itemListContent, false);
    	item.SetData(new Item("POTION_HEALING_SMALL")); // metaId
    	item.onClick.AddListener(ShowItem);
    }
    
    void ShowItem(Item item)
    {
        ItemInspectorUI itemUI = UIManager.current.GetUI<ItemInspectorUI>();
        itemUI.SetData(item);
        itemUI.Show();
    }

  35. Post #2755
    AtomiCal's Avatar
    December 2005
    709 Posts
    How bad will this blow up in my face? Intent is to have a UIManager singleton (eww, I know) accessed by calling UIManager.current.

    Code:
    BaseUI[] uiPanels;
    Dictionary<System.Type, BaseUI>() uiDict;
    
    public void Initialize()
    {
    	// uiPanels set in Inspector
    	uiDict = new Dictionary<System.Type, BaseUI>();
    	foreach(BaseUI ui in uiPanels)
    	{
    		ui.Initialize();
    		uiDict.Add(ui.GetType(), ui);
    	}
    }
    
    public T GetUI<T>() where T : BaseUI
    {
    	BaseUI def;
    	if(uiDict.TryGetValue(typeof(T), out def))
    		return def;
    
    	return null;
    }
    Usage:
    Code:
    void Awake()
    {
    	ItemButton item = Instantiate(itemButtonPrefab, itemListContent, false);
    	item.SetData(new Item("POTION_HEALING_SMALL")); // metaId
    	item.onClick.AddListener(ShowItem);
    }
    
    void ShowItem(Item item)
    {
        ItemInspectorUI itemUI = UIManager.current.GetUI<ItemInspectorUI>();
        itemUI.SetData(item);
        itemUI.Show();
    }
    Most of the people I meet, including myself, use this base class found on the Unity Wiki for creating singletons.

    https://wiki.unity3d.com/index.php/Singleton

  36. Post #2756
    Gold Member
    Why485's Avatar
    February 2010
    5,624 Posts


    I was digging through the code in my old Cockpit project, particularly the nebula code, and noticed that it was mostly self contained. I had always wanted to separate this out into something usable so I spent a bit of time today finally doing it.

    The github project can be found here

    I was always pretty happy with how it turned out. The concepts behind it are very simple, but itís pretty effective. That being said, Iím not completely happy with how some of it is implemented. Itís not the easiest thing to port to a new project, and it requires more scene specific setup than Iím comfortable with. It also relies on the old Unity fog, which is slowly being deprecated and doesnít work correctly with deferred rendering.

    Regardless, it was a very interesting project and thought it was worth sharing.
    Reply With Quote Edit / Delete Reply Windows 10 Chrome United States Show Events Useful Useful x 2 (list)

  37. Post #2757
    A six sided fish cube of the Flounder variety
    TheGoodDoctorF's Avatar
    March 2010
    4,116 Posts
    So I'm using InControl to handle input devices for a local multiplayer game. I plan on assigning devices to a list. In short, I want to access this list between levels. A combination of a singleton and DontDestroyOnLoad() seems to be the most common solution, but I was wondering if you guys had any other suggestions. It seems like Don'tDestroyOnLoad might make things messy.

  38. Post #2758
    Gold Member
    Janooba's Avatar
    February 2008
    1,588 Posts
    So I'm using InControl to handle input devices for a local multiplayer game. I plan on assigning devices to a list. In short, I want to access this list between levels. A combination of a singleton and DontDestroyOnLoad() seems to be the most common solution, but I was wondering if you guys had any other suggestions. It seems like Don'tDestroyOnLoad might make things messy.
    You could always use a ScriptableObject. They're a nice way to store information that you might otherwise put into a singleton, but also get serialized properly by Unity. I'd look into it at least.

  39. Post #2759
    Gold Member
    Umbra Fidelis's Avatar
    April 2011
    667 Posts
    A colleague of mine has been working on a collection of tools that we use on some of our projects, it's totally free of use too.

    If you guys want to check it out you can find it here: https://github.com/ArchonInteractive/SwissArmyLib/wiki

    It's still W.I.P and some classes needs documentation.

  40. Post #2760
    Gold Member
    samuel2213's Avatar
    May 2011
    2,730 Posts
    So after having nothing but trouble in UE4, decided to move to Unity for this project.
    I'm working on getting nice anime shading without relying on baked lighting or pre-determined shading maps.

    Still missing the emissive on the eyes and torso, and missing the decal texture on the torso.
    Also currently just using a basic toon shader found online till I make something myself.
    Reply With Quote Edit / Delete Reply Windows 10 Firefox Australia Show Events Artistic Artistic x 5 (list)