GameObject Lock

Hi

I am working on a new small utility to lock GameObjects in a scene so that you or others don’t move/scale/rotate objects by mistake.
This is obviously not the first utility to solve this problem and if you are just looking for a simple tool to lock a GameObject I would recommend the UnityLock (Unity Asset Store - The Best Assets for Game Making).

I made this for our own production, but wrapped it up nicely and plan to continue to support it.

It’s released!
Get it

The idea is to save the locked state of the objects in the scene so that we can commit it. This also makes it work for prefabs in scenes.

Features:

  • Lock any GameObject so that you or others don’t edit it by mistake
  • Locks are saved in the scene and will be comitted as part of it
  • Locks all Components and not just Transform
  • Works well with prefabs
  • Full undo/redo support
  • No gizmos when selected
  • Lock icons in hierarchy and scene
  • Clicking locked/unlocked icon can toggle state

Screenshots: (is there no way to embed?)





1386189--70941--$Screen Shot 2013-10-14 at 6.42.39 PM.png

Great work can you add password system.

Hi Tim,
your link don’t work.

Play_Edu: Why would you want password protection?
Sefou: Which link? Everything seems to work here.

Hi,
the link " Download it " :
http://kanako.dk/clients/AssetStore/Lock/GameObjectLock_rc1.unitypackage

It was linking to a .unitypackage. I have uploaded a zip file as well. Hope it works for you.

Cool. Thanks. :slight_smile:

It’s out!

I also noticed the first bug, but it’s fixed and submitted so it should be online soon.

Hi Tim,

Very useful, however I am having some issues using this together with Favourites Tab~~.~~
When you display the unlock icons in the hierarchy it is impossible to select it and lock the object. The Favourites Tab icon always wins and is enabled instead. No matter how many times I try to select the lock icon it doesn’t work and I am forced to do it manually through the menu system.

Hi!

I came across a bug today while using GameObject Lock (v1.02). I have a couple of prefabs which I want to lock, but every time I press Play, and then return to the editor, the items are unlocked again. I tested this with a standard cube, same result. I then looked at the cache object, and noticed that it doesn’t update the list with Scene Objects. Is there a quick and simple fix for this?

Thank you!

EDIT: Also noticed that when I go to GameObject → Lock → Preferences, a black window opens and I get the following error:

NullReferenceException
LockedObjectWindow.DrawList () (at Assets/Extensions/GameObject Lock/Editor/LockedObjectWindow.cs:99)

Deleting all GameObject Lock stuff and reimporting does not solve this. :frowning:

radimoto: Can you give me a screenshot? I will add an option so it should work better with other plugins.
SoftwareBug: I can’t reproduce this. Can you give me some more info: Your version of Unity, target platform, and you development platform. I’ll look into it when I have more info.

Hi Tim,

My Unity version is: 4.2.1f4. Target is Windows, using Unity Windows.
I created a new project, and can’t seem to replicate it now. Thank you for your help though, If I come across it again I’ll pay more attention to what I did to cause it.

EDIT: Encountered it again in my new project. Just to add to the info above, it is Unity Pro.

What happened:
I was adding new models to the project. Had the two tiles-01 and the sand-01 models locked. Then I added Wall-01 and locked that, but it just doesn’t update the _lockedGameObjects Scene Objects anymore. (See image, in the Hierarchy the Sand-01, 2x Tiles-01 and Wall-03 are locked. But in the _lockedGameObjects the wall-03 is not added.)

1407796--73409--$locks.jpg

If I unlock tiles-01, it also just keeps it in the Scene Objects list. The result of this is dat every time I press Play in the Unity Editor, and return, only the 3 items in the Scene Objects lists are locked again and the rest is unlocked.

Thank You

Hey Tim, great asset - this was a feature request years ago that has never surfaced, so good on you.

A few ideas if you want to expand it’s usefulness:

  • Colour coding/tagging GameObjects (OS X style)
  • Gizmo-style Filtering in the perspective Views based on the above tags (hide by tag)

I’m sure lots of other users with big projects and complex scenes would find this extremely useful.

SoftwareBug: Can you send me your scene, then I’ll boot my windows computer and work on it. I’m on mac and can’t reproduce. Send it to tim@kanako.dk or give me a link here.

Pix10: Colour coding/tagging is a great idea, but doesn’t seem that relevant to locking. Maybe something that someone (maybe even you?) could make :slight_smile:
I will consider it.

Hi when I double click to lock in hierarchy, it only locks the gameobject. Can you add option to lock children as well.

Does it affect selection? I am having this problem and I can’t seem to get a fix:
https://dl.dropboxusercontent.com/u/12006/Unity2.mp4

Does this lock objects from being selected? If so, I’m buying this right now!