Options

[Game Dev] I don't have a publisher. What I do have are a very particular set of skills.

13468993

Posts

  • Options
    AnarchyAnarchy Registered User regular
    edited November 2016
    Currently trying to optimise levels loads in Unity. Whats the best way to do Async operations? I've heard people say Resources.LoadAsync and others say AssetBundle, the latter of which looks like a square peg round hole kind of thing. Any other strategies I've missed. Currently, my code loads the level (which the loading screen over the top) and then the loading screen hangs as the non async blocks the UI / animation thread.

    Anarchy on
    "Oh, well, this would be one of those circumstances that people unfamiliar with the law of large numbers would call a coincidence."
  • Options
    LaCabraLaCabra MelbourneRegistered User regular
  • Options
    ElvenshaeElvenshae Registered User regular
    That's crazy.

    Is that specifically scripted, or just lucky physics engine work?

  • Options
    templewulftemplewulf The Team Chump USARegistered User regular
    LaCabra wrote: »
    That's amazing!

    And it seems like a fun upgrade power, especially if you can give it a ricochet line that will show the arrow's path in some UI color.

    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • Options
    RoyceSraphimRoyceSraphim Registered User regular
    edited November 2016
  • Options
    KupiKupi Registered User regular
    Mimicking Pixel Displays In Unity

    One of the problems that modern graphics technology presents for a game developer trying to mimic retro games consoles is all the effort put into smoothing things out. In Unity, it's easy enough to select a point filter instead of using bilinear interpolation when importing your sprites, but the tendency toward smoothness isn't just limited to static graphics. If you just let objects render at whatever their transform is set to, you'll wind up with smoother motion than retro games tended to support. Today I devised a way of getting around that problem.

    There are a few preconditions to the current implementation:
    - Sprites must be imported with Point filtering.
    - Sprites must be imported at a scale of 1 pixel = 1 unity unit.
    - The width and height of all sprites must be divisible by 2. Otherwise, they will have half-pixel overlaps with each other, breaking the retro verisimilitude.

    Rather than attaching a Sprite Renderer to the main GameObject, you put the Sprite Renderer on a second GameObject, parented to the first. Then you add the script PixelFixer, which has a single event function:
    void LateUpdate()
    {
        transform.localPosition = new Vector3(Mathf.RoundToInt(transform.parent.position.x) - transform.parent.position.x, Mathf.RoundToInt(transform.parent.position.y) - transform.parent.position.y, 0);
    }
    

    This code sets the local position of the Sprite Renderer to whatever value is required to align it to an integer boundary, without affecting the transform of the parent object. The result is that the sprite is always rendered on the exact pixels, with no interpolated value. However, gameplay is still managed using floating-point values, so all the movement calculations are still correct and can operate at sub-pixel resolution.

    I rigged up a special version of the Pixel Fixer to toggle between applying the fix and not to demonstrate the effect. You can see the results below:

    https://www.youtube.com/watch?v=EKf3wFs4DFc

    My favorite musical instrument is the air-raid siren.
  • Options
    LaCabraLaCabra MelbourneRegistered User regular
    Elvenshae wrote: »
    That's crazy.

    Is that specifically scripted, or just lucky physics engine work?

    Just a lucky shot!

  • Options
    templewulftemplewulf The Team Chump USARegistered User regular
    Is there an accepted best practice in Unity to change player controls or take control away?

    Example scenarios:
    1. You're in the middle of a turn based fight, and the player selects an option from a menu. You close the menu, take control away, play out a mini custcene of sorts that animates the action chosen by the player. Once that's done, the menu comes back up, and player resumes control.
    2. You are moving the character around with something typical of the "character control script" all over Unity tutorials. You click on some NPC, control is changed to only interact with a dialog window.
    3. You go from one action sequence to another, like character action games getting interrupted by QTEs.

    A lot of the tutorials I've seen do something awful like setting a mode flag and checking it at every turn. I decided to put together a mode tracking class, akin to a finite state machine. Each control "phase" is a class, and only the active phase in the stack receives input from the player.

    But the more I tinker with it, the more I'm convinced somebody has to have done this before. Is there an accepted way to do this? Is there a Unity Asset with all this work done already?

    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • Options
    RendRend Registered User regular
    edited November 2016
    templewulf wrote: »
    Is there an accepted best practice in Unity to change player controls or take control away?

    Example scenarios:
    1. You're in the middle of a turn based fight, and the player selects an option from a menu. You close the menu, take control away, play out a mini custcene of sorts that animates the action chosen by the player. Once that's done, the menu comes back up, and player resumes control.
    2. You are moving the character around with something typical of the "character control script" all over Unity tutorials. You click on some NPC, control is changed to only interact with a dialog window.
    3. You go from one action sequence to another, like character action games getting interrupted by QTEs.

    A lot of the tutorials I've seen do something awful like setting a mode flag and checking it at every turn. I decided to put together a mode tracking class, akin to a finite state machine. Each control "phase" is a class, and only the active phase in the stack receives input from the player.

    But the more I tinker with it, the more I'm convinced somebody has to have done this before. Is there an accepted way to do this? Is there a Unity Asset with all this work done already?

    probably the right way to work with it would be to have a class which gathers all the input events and then passes them down a stack of subscribed components. A component gets the event, can react to the event, and can flag it as consumed. If consumed, the event stops getting passed down that stack. This pattern emulates how human input events are propagated through operating systems.

    1. In this example the menu subscribes when it displays and unsubscribes when it goes away.
    2. In this example the text box is pushed onto the stack over the more general character control. The text box always consumes all input (to prevent it from bubbling downward)
    3. Same as example 1 basically

    Rend on
  • Options
    templewulftemplewulf The Team Chump USARegistered User regular
    edited November 2016
    Rend wrote: »
    templewulf wrote: »
    Is there an accepted best practice in Unity to change player controls or take control away?

    Example scenarios:
    1. You're in the middle of a turn based fight, and the player selects an option from a menu. You close the menu, take control away, play out a mini custcene of sorts that animates the action chosen by the player. Once that's done, the menu comes back up, and player resumes control.
    2. You are moving the character around with something typical of the "character control script" all over Unity tutorials. You click on some NPC, control is changed to only interact with a dialog window.
    3. You go from one action sequence to another, like character action games getting interrupted by QTEs.

    A lot of the tutorials I've seen do something awful like setting a mode flag and checking it at every turn. I decided to put together a mode tracking class, akin to a finite state machine. Each control "phase" is a class, and only the active phase in the stack receives input from the player.

    But the more I tinker with it, the more I'm convinced somebody has to have done this before. Is there an accepted way to do this? Is there a Unity Asset with all this work done already?

    probably the right way to work with it would be to have a class which gathers all the input events and then passes them down a stack of subscribed components. A component gets the event, can react to the event, and can flag it as consumed. If consumed, the event stops getting passed down that stack. This pattern emulates how human input events are propagated through operating systems.

    1. In this example the menu subscribes when it displays and unsubscribes when it goes away.
    2. In this example the text box is pushed onto the stack over the more general character control. The text box always consumes all input (to prevent it from bubbling downward)
    3. Same as example 1 basically

    That's pretty close to what I have now, except I don't pass events down the stack, since I couldn't think of a scenario in which I'd want to. It's a good point about the UI parallels, though!

    My main confusion is... isn't this a solved problem? Isn't there something in the Unity library or Asset store that automates more of this?

    Edit: I'm thinking of a hypothetical class onto which you'd push subscribers. Some kind of central repository.

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • Options
    RendRend Registered User regular
    templewulf wrote: »
    Rend wrote: »
    templewulf wrote: »
    Is there an accepted best practice in Unity to change player controls or take control away?

    Example scenarios:
    1. You're in the middle of a turn based fight, and the player selects an option from a menu. You close the menu, take control away, play out a mini custcene of sorts that animates the action chosen by the player. Once that's done, the menu comes back up, and player resumes control.
    2. You are moving the character around with something typical of the "character control script" all over Unity tutorials. You click on some NPC, control is changed to only interact with a dialog window.
    3. You go from one action sequence to another, like character action games getting interrupted by QTEs.

    A lot of the tutorials I've seen do something awful like setting a mode flag and checking it at every turn. I decided to put together a mode tracking class, akin to a finite state machine. Each control "phase" is a class, and only the active phase in the stack receives input from the player.

    But the more I tinker with it, the more I'm convinced somebody has to have done this before. Is there an accepted way to do this? Is there a Unity Asset with all this work done already?

    probably the right way to work with it would be to have a class which gathers all the input events and then passes them down a stack of subscribed components. A component gets the event, can react to the event, and can flag it as consumed. If consumed, the event stops getting passed down that stack. This pattern emulates how human input events are propagated through operating systems.

    1. In this example the menu subscribes when it displays and unsubscribes when it goes away.
    2. In this example the text box is pushed onto the stack over the more general character control. The text box always consumes all input (to prevent it from bubbling downward)
    3. Same as example 1 basically

    That's pretty close to what I have now, except I don't pass events down the stack, since I couldn't think of a scenario in which I'd want to. It's a good point about the UI parallels, though!

    My main confusion is... isn't this a solved problem? Isn't there something in the Unity library or Asset store that automates more of this?

    Man the fact that unity doesn't already work like that by default really makes me scratch my head. No idea if there's a good unity asset or library from the store but it frustrates me every time I think about it :p

  • Options
    templewulftemplewulf The Team Chump USARegistered User regular
    Rend wrote: »
    templewulf wrote: »
    Rend wrote: »
    templewulf wrote: »
    Is there an accepted best practice in Unity to change player controls or take control away?

    Example scenarios:
    1. You're in the middle of a turn based fight, and the player selects an option from a menu. You close the menu, take control away, play out a mini custcene of sorts that animates the action chosen by the player. Once that's done, the menu comes back up, and player resumes control.
    2. You are moving the character around with something typical of the "character control script" all over Unity tutorials. You click on some NPC, control is changed to only interact with a dialog window.
    3. You go from one action sequence to another, like character action games getting interrupted by QTEs.

    A lot of the tutorials I've seen do something awful like setting a mode flag and checking it at every turn. I decided to put together a mode tracking class, akin to a finite state machine. Each control "phase" is a class, and only the active phase in the stack receives input from the player.

    But the more I tinker with it, the more I'm convinced somebody has to have done this before. Is there an accepted way to do this? Is there a Unity Asset with all this work done already?

    probably the right way to work with it would be to have a class which gathers all the input events and then passes them down a stack of subscribed components. A component gets the event, can react to the event, and can flag it as consumed. If consumed, the event stops getting passed down that stack. This pattern emulates how human input events are propagated through operating systems.

    1. In this example the menu subscribes when it displays and unsubscribes when it goes away.
    2. In this example the text box is pushed onto the stack over the more general character control. The text box always consumes all input (to prevent it from bubbling downward)
    3. Same as example 1 basically

    That's pretty close to what I have now, except I don't pass events down the stack, since I couldn't think of a scenario in which I'd want to. It's a good point about the UI parallels, though!

    My main confusion is... isn't this a solved problem? Isn't there something in the Unity library or Asset store that automates more of this?

    Man the fact that unity doesn't already work like that by default really makes me scratch my head. No idea if there's a good unity asset or library from the store but it frustrates me every time I think about it :p

    Right!? That's why I've been looking through libraries and the store so much. I feel like I'm really missing something.

    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • Options
    RoyceSraphimRoyceSraphim Registered User regular
    Sounds like y'all have a project to work on together.

  • Options
    templewulftemplewulf The Team Chump USARegistered User regular
    @Rend , it looks like they're working on a "New Input System", which will a.) obviate the need for a lot of what Rewired fixes about the old system, and b.) create input states which will live in a stack and may or may not pass inputs down through the stack, which will take care of a lot of what we're talking about.

    https://sites.google.com/a/unity3d.com/unity-input-advisory-board/design-overview

    I'm going to try it out to see if it still needs any kind of scaffolding.

    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • Options
    RoyceSraphimRoyceSraphim Registered User regular
    In Gamemaker,
    If you place an object in a room, and decide to change its origin point of its sprite, the entire object in that room will change to reflect the change in sprite origin.

    Thankfully, this was just the single static boss, and not multiple objects.

  • Options
    UselesswarriorUselesswarrior Registered User regular
    It's so weird to see people discussing Unity and it being so alien to me, dispite having just released a game in Unity. Doing everything in an Entity Component System style defiantly isolated me from the larger community.

    Hey I made a game, check it out @ http://ifallingrobot.com/. (Or don't, your call)
  • Options
    AnarchyAnarchy Registered User regular
    Played around with VR development last weekend. Didn't get too far but really happy with the results:

    https://www.youtube.com/watch?v=mSdZknTppqE&feature=youtu.be

    "Oh, well, this would be one of those circumstances that people unfamiliar with the law of large numbers would call a coincidence."
  • Options
    KamiKami Registered User regular
    I'm finally playing around with RPGMaker MV, and I'm enjoying how easy it is to get started

    Since I'm new to the whole idea of programming and logic, having the workflow set up that easily with pre-built assets is really fun!

    Yesterday I was able to create a situation to where you would approach a shopkeep, and if you had less than enough money for an item, he'd give you a hint on where to find his secret stash of gold in the town. Then the event would unlock to give the character the gold a single time, and upon approaching the shopkeep after retrieving the gold, he talks about how he always keeps extra gold for "emergency hero fund"

    I ran into a problem to where since the engine was checking how much gold was in your inventory, if you ended up spending the gold to get below the threshold again, his secret stash would respawn and give you more gold. I figured it out by having a new self-switch run within the event the first time, that led to a second event that says 'You've already got the shopkeep's secret gold!'

    Worked like a charm! It's fun to see the cause and effect of playing with switches and variables and conditions like that.

  • Options
    RendRend Registered User regular
    It's so weird to see people discussing Unity and it being so alien to me, dispite having just released a game in Unity. Doing everything in an Entity Component System style defiantly isolated me from the larger community.

    The input problem in particular is not solved by Entitas. The ECS framework doesn't prevent inputs from bubbling down after they should have been consumed.

  • Options
    templewulftemplewulf The Team Chump USARegistered User regular
    templewulf wrote: »
    @Rend , it looks like they're working on a "New Input System", which will a.) obviate the need for a lot of what Rewired fixes about the old system, and b.) create input states which will live in a stack and may or may not pass inputs down through the stack, which will take care of a lot of what we're talking about.

    https://sites.google.com/a/unity3d.com/unity-input-advisory-board/design-overview

    I'm going to try it out to see if it still needs any kind of scaffolding.

    Well, the editor crashed on me several times, but they said "For now we're interested in discussion around the design of the system. We don't need bug reports quite yet at this stage in development." So, it's clearly a WIP.

    There doesn't seem to be any unifying "mode" idea. Like if I pull up a menu, I haven't found any built in class that I can attach that to that will automatically set Time.timeScale = 0. Or if there's some data that really only matters for an "RPG battle" class, you'll have to manage the switch to using that class and these controls separately.

    Still, it wouldn't take much effort to roll up a class like that, and the changes are pretty encouraging. I haven't seen a timeline on when this'll make it into the master branch, but I'm going to pounce on it ASAP.

    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • Options
    UselesswarriorUselesswarrior Registered User regular
    Rend wrote: »
    It's so weird to see people discussing Unity and it being so alien to me, dispite having just released a game in Unity. Doing everything in an Entity Component System style defiantly isolated me from the larger community.

    The input problem in particular is not solved by Entitas. The ECS framework doesn't prevent inputs from bubbling down after they should have been consumed.

    I'd have a system read the raw inputs and turn it into state (aka components). Other systems would consume on those components, but I'd make it so only one system would be set to active, so input state would only have one consumer at a time.

    Hey I made a game, check it out @ http://ifallingrobot.com/. (Or don't, your call)
  • Options
    RendRend Registered User regular
    Rend wrote: »
    It's so weird to see people discussing Unity and it being so alien to me, dispite having just released a game in Unity. Doing everything in an Entity Component System style defiantly isolated me from the larger community.

    The input problem in particular is not solved by Entitas. The ECS framework doesn't prevent inputs from bubbling down after they should have been consumed.

    I'd have a system read the raw inputs and turn it into state (aka components). Other systems would consume on those components, but I'd make it so only one system would be set to active, so input state would only have one consumer at a time.

    Take for instance a game like starcraft where you can click buttons on a hud UI display and also you can click to select units. Unity has methods that allow you to subscribe objects to mouse click events, which is good because that's exactly the sort of reason you use an engine, to abstract away that sort of mundane task. However, by default you would not only click one of the UI buttons, but the click would travel "through" the UI panel and into the game space beyond it, possibly selecting a unit which was "behind" the UI button.

    The problem is that some games require more than one input system to be active at a time. In this case, there is a hud full of buttons to click and also a game space full of units to select. Of course, you could just take raw mouse inputs and raycast into the world (and ensure you raycasted through the hud if necessary) and then only use the game space input if it didn't go through the hud, but then at that point you're implementing a workaround for the exact problem we're complaining about.

  • Options
    UselesswarriorUselesswarrior Registered User regular
    Yeah that's mixing UI and Game Logic, which you could argue are ultimately the same thing. My experience was isolating the game logic into ECS and the UI was all terribad not great Unity UI stuff.

    I haven't done enough experimentation into ECS to drive UIs to see if it's appropriate. If it did work I have a few ideas how I would fix that.

    Pure Unity has some rough edges and that sounds like a major one.

    Hey I made a game, check it out @ http://ifallingrobot.com/. (Or don't, your call)
  • Options
    RendRend Registered User regular
    edited November 2016
    Unity's UI is a major rough edge for the engine.

    It's a pain manually coding whether or not a button has been clicked, for one thing. So there's a lot of incentive to use Unity's UI button stuff there.

    ECS doesn't prevent you from having to deal with it, it just offers a decent way to solve it yourself. At its base the problem is that a a given input should only be consumed by one system, but many systems may need to be active at a time, so you need a stack of UI consumers. You can, of course, do that in ECS, but that requires you to hand code things like a mouse click's raycasts and collisions. A button input is easier to deal with because at least you don't need to know what a button is pointing at.

    The point is that Unity is a sophisticated enough engine that I should be able to have unity code generating my input entities reliably, as opposed to having an entitas system generating those entities from raw inputs, because an entitas system would need to reinvent all of the necessary wheels (mouse collisions, etc), but unity code would be able to fully leverage the engine.

    Rend on
  • Options
    UselesswarriorUselesswarrior Registered User regular
    edited November 2016
    Yeah I was initially thinking of touch input but mouse driven menus are (surprisingly) a pain in Unity. When I played around with them I assumed I was doing something wrong, but it's possible that Unity just has a broken model for all but the simplest of use cases.

    In my case, I just pause my game (ECS) systems when I had a menu open. No game systems active to register touches, so they all went to the menu.

    Uselesswarrior on
    Hey I made a game, check it out @ http://ifallingrobot.com/. (Or don't, your call)
  • Options
    RendRend Registered User regular
    edited November 2016
    ...Unity just has a broken model for all but the simplest of use cases.

    ding ding ding!

    [EDIT] Sorry I was being serious when I mentioned it frustrates me every time I think about it :p

    Rend on
  • Options
    UselesswarriorUselesswarrior Registered User regular
    Unity is the worst game engine except for all the others.

    Hey I made a game, check it out @ http://ifallingrobot.com/. (Or don't, your call)
  • Options
    RoyceSraphimRoyceSraphim Registered User regular
    I timed the length of my level, and then timed the SNES side scrolling shooter I used as a guide, and realized that 2:55 was too long for a first level.

    I also realized that image_angle != direction by default and should be set.

  • Options
    CornucopiistCornucopiist Registered User regular
    I think they might just not be very game UI oriented, but then on the other hand they're super proud of the editor UI editing functions?
    I installed UI extensions which at least got me 'on click' for steering pedals made out of buttons, but then of course transparency doesn't work for some reason, so at one point I'll have to go back and just get touch events and check for the screen area, instead.

  • Options
    AnteCantelopeAnteCantelope Registered User regular
    Does anyone know of a good UI framework to get prototypes up and running quickly? Maybe in Unreal or Unity, maybe not.

    What I'm looking for is just a simple easy way to get buttons and display information. So, for instance I'm working on a card game, and I'd like to have something that can show cards and game state, without having to work too hard on the UI. I want to work on something like Football Manager using it too.

    Just for context: I've tried working in both Unity and UE3, and I get stuck when it takes me hours to get simple buttons and display up, when that's not at all what I want to be working on.

  • Options
    KashaarKashaar Low OrbitRegistered User regular
    Does anyone know of a good UI framework to get prototypes up and running quickly? Maybe in Unreal or Unity, maybe not.

    What I'm looking for is just a simple easy way to get buttons and display information. So, for instance I'm working on a card game, and I'd like to have something that can show cards and game state, without having to work too hard on the UI. I want to work on something like Football Manager using it too.

    Just for context: I've tried working in both Unity and UE3, and I get stuck when it takes me hours to get simple buttons and display up, when that's not at all what I want to be working on.

    UE4's built-in UI system is pretty easy to use and powerful. Displaying some data is as easy as adding a text or progress bar element or whatever, and binding its data to whatever actor's properties it should display. Making buttons interactive is as simple as adding a button element, and adding an OnPressed event for it.
    It's all using blueprints, which unfortunately means that if you want to use it with C++ you're gonna have a slightly harder time, since the docs don't really cover that so much. Oh yeah, here's the main docs about it: https://docs.unrealengine.com/latest/INT/Engine/UMG/

    Indie Dev Blog | Twitter | Steam
    Unreal Engine 4 Developers Community.

    I'm working on a cute little video game! Here's a link for you.
  • Options
    AnteCantelopeAnteCantelope Registered User regular
    Thanks, I'm giving that a look now and will post again if I have questions

  • Options
    templewulftemplewulf The Team Chump USARegistered User regular
    Has anyone found a good generic Pool<T> class for C# in Unity? Unity doesn't use MS's 4.0 version of .NET, so the ConcurrentBag class used on MSDN's example is unavailable.

    I'm throwing a little one together, but I'd rather switch to something tested before I discover all the edge cases I didn't want to know about.

    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • Options
    UselesswarriorUselesswarrior Registered User regular
    What does Pool do?

    Also when the hell is Unity going to upgrade to a later version of C#? It was an annoying pain point.

    Hey I made a game, check it out @ http://ifallingrobot.com/. (Or don't, your call)
  • Options
    RoyceSraphimRoyceSraphim Registered User regular
    Is it weird of me to take every complicated bit of I have and pack it inside a script so nothing gets misplaced?

  • Options
    templewulftemplewulf The Team Chump USARegistered User regular
    What does Pool do?

    Also when the hell is Unity going to upgrade to a later version of C#? It was an annoying pain point.

    It's just an ordinary object pool to help you avoid construction, deconstruction costs. Basically, an item is just checked out and back in.

    It's pretty easy to make for game objects, using the active status as a flag for being in use. I was just after something a little more rigorous.

    I read that unity not only doesn't use Microsoft's . Net, but they don't even use Mono's. It's a customized subset, like a manufacturer specific distribution of Android.

    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • Options
    UselesswarriorUselesswarrior Registered User regular
    edited November 2016
    Yeah they are using IL2CPP, which transcode C# to C++.

    In my game my pool was backed by a standard Dictionary, which was a enum I created for each "view" mapped to a Stack of GameObjects. When ever I went to allocate a game object I'd first check to see if I had a disabled object in my pool.
    GameObject LoadPooledView(ViewResource res)
    {
        var viewPool = pool.viewPool.pool;
        Stack<GameObject> existingViews;
        bool existingPool = viewPool.TryGetValue(res, out existingViews);
        if (existingPool && existingViews.Count > 0)
        {
            var gameObject = existingViews.Pop();
            gameObject.SetActive(true);
            return gameObject;
        }
        return LoadView(Path + res);
    }
    

    I am assuming you are trying to create the pool to avoid GameObject allocation. That can get costly, especially on mobile, though in my game it actually wasn't a huge deal.

    Uselesswarrior on
    Hey I made a game, check it out @ http://ifallingrobot.com/. (Or don't, your call)
  • Options
    templewulftemplewulf The Team Chump USARegistered User regular
    Yeah they are using IL2CPP, which transcode C# to C++.

    In my game my pool was backed by a standard Dictionary, which was a enum I created for each "view" mapped to a Stack of GameObjects. When ever I went to allocate a game object I'd first check to see if I had a disabled object in my pool.
    GameObject LoadPooledView(ViewResource res)
    {
        var viewPool = pool.viewPool.pool;
        Stack<GameObject> existingViews;
        bool existingPool = viewPool.TryGetValue(res, out existingViews);
        if (existingPool && existingViews.Count > 0)
        {
            var gameObject = existingViews.Pop();
            gameObject.SetActive(true);
            return gameObject;
        }
        return LoadView(Path + res);
    }
    

    I am assuming you are trying to create the pool to avoid GameObject allocation. That can get costly, especially on mobile, though in my game it actually wasn't a huge deal.

    Yeah, that's similar to what I have. Though, mine doesn't have to be for every object. I've got one with a prefab field for producing copies of frequently created/destroyed objects, like bullets or swarms of enemies.

    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • Options
    RoyceSraphimRoyceSraphim Registered User regular
    I have created an opening menu.

    But now I look towards making a pause menu and realize how difficult that is.

  • Options
    UselesswarriorUselesswarrior Registered User regular
    Menus are a god damn pain in the ass. Mostly because they eat cycles you'd rather be spending on the game itself.

    Hey I made a game, check it out @ http://ifallingrobot.com/. (Or don't, your call)
Sign In or Register to comment.